Send template message
- Go to BIK dashboard and in the templates section get the id of the template which you want to send. In case you are not able to find it, you can also ask your account manager.
There are six types of common template messages
There are some advanced templates as well (example one with QRBs / List / Cart), those messages can be triggered via the flow API.
Request parameters
Name | Type | Required/Optional | Description |
---|---|---|---|
medium | string | Required | Messages will be send through this medium( whatsapp for now ) |
contactIdentifier | string | Required | Phone number of user |
type | string | Required | Message type( CAROUSEL , DEFAULT ) |
businessPhoneNumber | string | Optional | Business phone number from which you want to send the message |
payload | BikTemplateMessagePayload or BikCarouselMessagePayload | Required | Template message object type. Check the BikTemplateMessagePayload, BikCarouselMessagePayload type here. |
Request Information
- Send Template Message V2
- Send Template Message
Category | Value |
---|---|
Http request | POST |
URL | https://bikapi.bikayi.app/integrations/bikPlatformFunctions-messages/v2/sendTemplateMessage |
Sample request
curl --location 'https://bikapi.bikayi.app/integrations/bikPlatformFunctions-messages/v2/sendTemplateMessage' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic AUTH_TOKEN' \
--data '{
"appId": "APP_ID",
"contactIdentifier": "+919900990090,
"medium": "whatsapp",
"payload": {
"templateId": "TEMPLATE_ID",
"components": {
"header": [
{
"type": "image",
"data": "https://testimageurl.com/testimage.png"
}
],
"body": [
"Test"
],
"button": [
{
"type": "URL",
"index": 0,
"data": "https://www.google.com"
}
]
}
}
}'
JSON response example:
{
"status": 200,
"success": true,
"data": {
"id": "wamid.HBgMOTE5OTM4NDM4MTM4FQIAERgSMTJCRTg3M0MxREUyNkURatyAA=="
}
}
Response parameters
Name | Type | Description |
---|---|---|
status | number | Response status |
success | boolean | Is successful response or not |
data | Response | Message ID in the response |
Note:
API version 1 is deprecated. Please use v2.
Category | Value |
---|---|
Http request | POST |
URL | https://bikapi.bikayi.app/integrations/bikPlatformFunctions-messages/sendTemplateMessage |
Sample request
curl --location 'https://bikapi.bikayi.app/integrations/bikPlatformFunctions-messages/sendTemplateMessage' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic AUTH_TOKEN' \
--data '{
"appId": "APP_ID",
"contactIdentifier": "+919900990090,
"medium": "whatsapp",
"payload": {
"templateId": "TEMPLATE_ID",
"components": {
"header": [
{
"type": "image",
"data": "https://testimageurl.com/testimage.png"
}
],
"body": [
"Test"
],
"button": [
{
"type": "URL",
"index": 0,
"data": "https://www.google.com"
}
]
}
}
}'
JSON response example:
{
"status": 200,
"success": true,
"response": {
"id": "wamid.HBgMOTE5OTM4NDM4MTM4FQIAERgSMTJCRTg3M0MxREUyNkURatyAA=="
}
}
Response parameters
Name | Type | Description |
---|---|---|
status | number | Response status |
success | boolean | Is successful response or not |
response | Response | Message ID in the response |
Errors
Error Code | Meaning |
---|---|
400 | Invalid payload -- Your request is invalid. |
401 | Unauthorized -- User is not authenticated. |
404 | Not Found -- The specified API could not be found. |
407 | Invalid template -- Invalid whatsapp template id. |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
Error response example:
{
"status": 407,
"error": "Invalid whatsapp template id"
}
The individual sections of WhatsApp match the schema of the WhatsApp message payload. You can find out details about message payload here