Skip to main content

Send Whatsapp Template Message For a phone number

The following API allows you to send a whatsapp template message for a given phone number

Note: All the apis accept api key based token authentication and return data within the wrapper { _data:{}, _meta: {}, _errors:[] }

Path

POST /v1/ext/plugin/whatsapp/<pluginId>/process/phoneNumber>/send-template-message

Following are valid examples of the path

POST /v1/ext/plugin/whatsapp/d83e1d23-50b8-4d87-8f92-842a0ac516f6/process/phoneNumber/913399113344/send-template-message
POST /v1/ext/plugin/whatsapp/d83e1d23-50b8-4d87-8f92-842a0ac516f6/process/phoneNumber/13323458424/send-template-message

Path parameters

ParamDescription
pluginIdThe whatsapp plugin id where you have connected your whatsapp account. Its an UUID. You can copy it from the plugin details page url /admin/plugin/d83e1d23-50b8-4d87-8f92-842a0ac516f6 The last part of the url is the plugin id
phoneNumberProvide a fully qualified phone number including country code and wihout '+' and any formatting characters. Valid examples of a valid phone number are - 913399113344, 13323458424

Body

The body is a json with the following parameters

ParamDescription
whatsappPhoneNumberIdProvide the whatsapp phone number id for the phone number you are going to use to send this message. Connected phone numbers and their Ids can be found in the plugin page
templateNameprovide the whatsapp template name here
mapping (optional)An array of mappings of tempalte parameters and their values. Should be in MappingType format
imageUrl (optional)If your template contains an image attachment, you need to provide a public url where the target image is hosted. You can use public media upload api to generate this url
videoUrl (optional)If your template contains an video attachment, you need to provide a public url where the target video is hosted. You can use public media upload api to generate this url
documentUrl (optional)If your template contains an document attachment, you need to provide a public url where the target document is hosted. You can use public media upload api to generate this url

Sample MappingType

[
{
"schemaPropertyName": "1",
"schemaPropertyValue": "John"
},
{
"schemaPropertyName": "2",
"schemaPropertyValue": "Monday"
}
]

Sample Body

{
"whatsappPhoneNumberId": "775966265503012",
"templateName": "christmas_promo_23",
"mapping": [
{
"schemaPropertyName": "1",
"schemaPropertyValue": "John"
}
],
"imageUrl": "https://chakra-public-media.chakrahq.com/5fc9f8e3-af4a-4f29-bfd8-6c02e3abe3ee/2024-10-17/9b755981-74f7-4cde-b495-cd7039991964.png",
}

Sample Response

{
"_data": {
"id": "359e676b-624f-45e9-833d-e109ae414557",
"createdAt": 1729231290842,
"updatedAt": 1729231290842,
"externalId": "wamid.HBgMOTE5OTAxMjU4NDMzFQIAERgSRjE4OEZFM0UyOTc1ODMyOUZEAA==",
"provider": "WHATSAPP",
"dataType": "text",
"body": {
"body": "Hi John,\nThis christmas decorate make your loved ones happier with Chakra Wellness products. Visit our website to know more!\n❄🎄"
},
"text": "Hi John,\nThis christmas decorate make your loved ones happier with Chakra Wellness products. Visit our website to know more!\n❄🎄",
"attachments": null,
"deliveryStatus": "SENT",
"direction": "OUTBOUND",
"timestamp": 1729231290387,
"context": {
"contactIdentifier": "919901258433",
"messageTemplateId": "e296d971-305c-4009-a9b6-2cb7fd1ee3cf"
},
"adhocAgent": null,
"source": {
"sourceId": "send-template-message-for-process",
"sourceType": "API"
},
"team": "5fc9f8e3-af4a-4f29-bfd8-6c02e3abe3ee",
"chat": null,
"plugin": "d83e1d23-50b8-4d87-8f92-842a0ac516f6",
"contact": null,
"user": "5bc39b1d-5aa7-48a3-9436-51c103a18a3b",
"procedure": null,
"process": "b656bf3b-4248-47f9-b145-c64452ae2b00",
"campaign": null,
"inReplyTo": null
}
}