Using WhatsApp Stickers with the Messages API
Stickers allow businesses to communicate with end users in an informal way similar to emojis, but with larger images and which can be customized to represent a brand. There are two ways to send a WhatsApp Sticker:
The method you can use to send a sticker depends on how your WhatsApp number is hosted:
| Vonage Hosting | WhatsApp Hosting | |
|---|---|---|
| Supported Stickers | Only static third-party outbound stickers are supported in addition to all types of inbound stickers. Animated stickers are not supported. | Static and animated third-party outbound stickers are supported in addition to all types of inbound stickers. |
| Sticker Size | A static sticker cannot exceed 100 KB, and must be 512x512 pixels. | A static sticker cannot exceed 100 KB. An animated sticker cannot exceed 500 KB. Both static and animated stickers must be 512x512 pixels. |
| Sending a Sticker | Can be sent using either the sticker ID or URL. | Can only be sent using the sticker URL. |
Using a Sticker URL
First, ensure that your sticker image has been uploaded and has a publicly accessible URL; it should be in a .webp format and follow the size guidelines above. Once you have the URL, you can follow the instructions in Use a Sticker URL to Send a Sticker.
Using a Sticker ID
Each sticker has a Sticker ID that is directly tied to your WhatsApp deployment; if you have a Sticker ID for one deployment, you cannot use the same ID in another deployment. To send a sticker using a Sticker ID it is necessary to:
- Get the Sticker ID from a sticker pack using the WhatsApp Provisioning API. There are several steps to this process:
- Send a
stickermessage type with the sticker ID inside using the Messages API.
Retrieve the Sticker ID
You can retrieve the ID of your chosen sticker via the WhatsApp Provisioning API.
Get Deployment ID
First, ensure you have provisioned a WhatsApp deployment. Use the following request to get the Deployment ID for your WhatsApp number:
A successful response will contain the property deployment_id:
Retrieve Stickerpacks
WhatsApp Stickerpacks and Stickers have two categories:
- First-Party Stickerpacks - Managed by WhatsApp (ready to be used).
- Third-Party Stickerpacks - Managed by a Business owning a number (custom).
If you want to use a custom sticker pack, you'll need to create a sticker app and release it to the Google Play store and/or the Apple App store. Take a look at the WhatsApp Documentation for more information on how to do this.
Here's an example of a request to retrieve WhatsApp First-Party Stickerpacks. The request contains a namespace parameter with the value whatsapp along with your deployment_id:
A successful response contains an object called stickerpacks containing the IDs for all of the available WhatsApp First-Party Stickerpacks:
Retrieve Sticker Indexes
We can now pick up a sticker pack ID and retrieve stickers indexes, for example this request retrieves the whatsapp-komo stickerpack:
A successful response contains the stickers object with all of the sticker indexes:
Retrieve Stickers
We can now pick up a sticker index and retrieve a sticker ID. For example, this request will retrieve the sticker with index 0:
The property id contains the value we need to provide in a Messages API request payload; in this case it's 13aaecab-2485-4255-a0a7-97a2be6906b9:
Send the Sticker Using the ID
Once you have the sticker ID, you can follow the instructions in Use a Sticker ID to Send a Sticker.
References: