Skip to main content

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.

Template id

  • 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

NameTypeRequired/OptionalDescription
mediumstringRequiredMessages will be send through this medium( whatsapp for now )
contactIdentifierstringRequiredPhone number of user
typestringRequiredMessage type( CAROUSEL, DEFAULT)
businessPhoneNumberstringOptionalBusiness phone number from which you want to send the message
payloadBikTemplateMessagePayload or BikCarouselMessagePayloadRequiredTemplate message object type. Check the BikTemplateMessagePayload, BikCarouselMessagePayload type here.

Request Information

CategoryValue
Http requestPOST
URLhttps://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

NameTypeDescription
statusnumberResponse status
successbooleanIs successful response or not
dataResponseMessage ID in the response

Errors

Error CodeMeaning
400Invalid payload -- Your request is invalid.
401Unauthorized -- User is not authenticated.
404Not Found -- The specified API could not be found.
407Invalid template -- Invalid whatsapp template id.
500Internal 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