sendCTLiveSocialTemplateMessage
Send a CTLiveSocial template message to a customer in a whatsapp chat.
Parameters:
Name | Mandatory | Type | Description |
---|---|---|---|
servicePhoneNumber | YES | STRING | whatsapp business number |
customerPhoneNumber | YES | string | customer phone number |
templateName | YES | string | template name |
language | YES | string | template language |
header | YES | object | template header (null if there is no header or no multimedia header). See table below for details. |
headerData | YES | array | array of strings representing the header parameters. (pass empty array in case there are no parameters) |
headerText | YES | string | header text (null if header type is not text) |
bodyData | YES | array | array of strings representing the body parameters. (pass empty array in case there are no parameters) |
bodyText | YES | string | body text |
footerText | YES | string | footer text (null if there is no footer) |
url | YES | string | url (null if there is no url) |
dynamic_url | YES | array | array of string representing the url parameter. (pass empty array in case there is no url parameter) |
Header object:
Name | Mandatory | Type | Description |
---|---|---|---|
type | YES | STRING | header type. Can assume one of the following values:
|
data | YES | string | base64 string |
documentType | YES | string | document extension |
fileName | YES | string | file name (extension included) |
Returns:
Type | Description |
---|---|
JS Promise |
A Javascript Promise that return an object containing the following properties:
|
Example:
template only text:
LIVECHAT.sendCTLiveSocialTemplateMessage("3902124122690", "393403602056", "hello_world", "en_US", null, [], "Hello World", [],
"Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.", "WhatsApp Business Platform sample message",
null, []
);
template text with parameter:
LIVECHAT.sendCTLiveSocialTemplateMessage("3902124122690", "393403602056", "sample_shipping_confirmation", "en_US", null, [], null, ["5"],
"Your package has been shipped. It will be delivered in {{1}} business days.", "This message is from an unverified business.",
null, []
);
multimedia template with image header:
self.sendCTLiveSocialTemplateMessage("3902124122690", "393403602056", "sample_purchase_feedback", "en_US",
{
"type": "image",
"data": "iVBORw0KGgo…=",
"documentType": "png",
"fileName": "infobip-logo"
},
[], null,
["our latest product"],
"Thank you for purchasing {{1}}! We value your feedback and would like to learn more about your experience.",
"This message is from an unverified business.",
null, []
);