How to download whole imageSet from LINE messenger API?

41 Views Asked by At

I am building a LINE bot that should receive images and save on server side. But if a user sends images simultaneously LINE Messaging API allows to download only the first one.

I've set up webhook to receive messages and send a one with multiple images attached. This it the payload I got from LINE

{
  "destination": "...",
  "events": [
    {
      "type": "message",
      "message": {
        "type": "image",
        "id": "499800547445702913",
        "quoteToken": "...",
        "contentProvider": { "type": "line" },
        "imageSet": {
          "id": "9D3B07BFAD1F6DFECD188AE07E13A28C8BC9CCB5E8E1F343346016EAC75DBC42",
          "index": 2,
          "total": 2
        }
      },
      "webhookEventId": "...",
      "deliveryContext": { "isRedelivery": false },
      "timestamp": 1710735645244,
      "source": {
        "type": "user",
        "userId": "..."
      },
      "replyToken": "...",
      "mode": "active"
    }
  ]
}

LINE API doc says to use the following method to download images

https://developers.line.biz/ja/reference/messaging-api/#get-content

GET https://api-data.line.me/v2/bot/conversation/<message id>/content

But the request above returns only the first image from the imageSet. How to download the rest ones?

0

There are 0 best solutions below