WhatsApp Sticker Messages

WhatsApp sticker messages can be sent and received through MessageBird WhatsApp channels. These are the requirements/limitations of WhatsApp sticker messages:

  • The sticker image must be available in a public URL or uploaded to MessageBird (refer to the next section)
  • The image format must be image/webp
  • The image size can't be bigger than 100 KB
  • The image dimensions must be exactly 512 x 512
  • Animated stickers are not supported at the moment
  • Native first party and third party WhatsApp stickers are not supported for outbound messages

Upload sticker image to MessageBird

In case you don't have the sticker image available in a public URL, you can upload the image to MessageBird using the following request.

curl -X POST https://messaging.messagebird.com/v1/files \
-H 'Authorization: AccessKey {your-access-key}' \
-H 'Content-Disposition: attachment; filename="{filename.webp}"' \
-H 'Content-Type: image/webp' \
--data-binary @{filename.webp}

Don't forget to replace {your-access-key} by your live access key, and {filename} by the file name. The HTTP response should look like the following.

{"id":"99449497-535c-46c1-b57c-ddd193edfc5b","name":"{filename.webp}"}

The HTTP response includes the ID of the uploaded file, which can be retrieved using the URL https://messaging.messagebird.com/v1/files/99449497-535c-46c1-b57c-ddd193edfc5b. This URL can be used in the field content.whatsappSticker.link to send the sticker message.

Sending a sticker message

In order to send sticker message, you can use any of the endpoints for sending messages in Conversations API with the message type whatsappSticker. The example below illustrates how to send it using the endpoint POST /v1/send.

curl -X "POST" "https://conversations.messagebird.com/v1/send" \
-H 'Authorization: AccessKey {your-access-key}' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"content": {
"whatsappSticker": {
"link": "{sticker-image-url}"
}
},
"to": "{destination}",
"type": "whatsappSticker",
"from": "{channel-id}"
}'

It's important to note the following:

  • Replace {your-access-key} by your live access key
  • Replace {sticker-image-url} by a valid and public URL, or use the URL provided by Messaging API as demonstrated in the previous section
  • Replace {destination} by a valid WhatsApp phone number
  • The message type must be whatsappSticker
  • Replace {channel-id} by an ID of an active WhatsApp channel

The HTTP response code should be 200 OK, and the response body should contain the message ID.

{
"id": "3b75218770cs44dha3je77896fa86d62",
"status": "accepted"
}

Optionally, you can use the endpoint for fetching message details (GET /v1/messages/{id}).

curl "https://conversations.messagebird.com/v1/messages/3b75218770cs44dha3je77896fa86d62" \
-H 'Authorization: AccessKey {your-access-key}' \
-H 'Content-Type: application/json; charset=utf-8'

The HTTP response should look like the following.

{
"id": "3b75218770cs44dha3je77896fa86d62",
"conversationId": "0b7c237df609487c9c41437tab502889",
"platform": "whatsapp",
"to": "+31600000000",
"from": "+31600000000",
"channelId": "54d17af6-98be-42u3-420c-4e98d04f023c",
"type": "whatsappSticker",
"content": {
"whatsappSticker": {
"link": "https://messaging.messagebird.com/v1/files/99449497-535c-46c1-b57c-ddd193edfc5b"
}
},
"direction": "sent",
"status": "delivered",
"createdDatetime": "2021-11-19T16:24:53.00257632Z",
"updatedDatetime": "2021-11-19T16:24:57Z"
}

Questions?

We’re always happy to help with code or other doubts you might have! Check out our Quickstarts, API Reference, Tutorials, SDKs, or contact our Support team.

Cookie Settings