crm messaging logo

Send WhatsApp Templates

To send WhatsApp templates, you need to first add template in Templates manager by following steps mentioned in guide How To Add A New Template? – CRM Messaging (crm-messaging.cloud)

Now to send templates, make a POST call to WhatsApp API

curl --location --request POST 'https://app.crm-messaging.cloud/index.php/Api/sendMsg' \
--header 'Authorization: Bearer API_TOKEN' \
--form 'to="PHONE_NUMBER"' \
--form 'msg="MESSAGE_BODY"' \
--form 'tempName="TEMP_UNIQUE_NAME"'

Here API_TOKEN can be found in the developer console Text Messaging for Marketers and Sales Reps – CRM Messaging (crm-messaging.cloud)

PHONE_NUMBER is to number with the country code where you want to send WhatsApp

MESSAGE_BODY is WhatsApp template body

tempName is the unique name of the template as saved in facebook WhatsApp template manager

Before calling this API, make sure your account is on paid PRO PLAN and your WhatsApp Business number is added to your account.

Additionally, if your template has media attachments or is multilingual or your account has multiple phone numbers and channels then pass these additional optional parameters in form data in API call

mediaUrl
fromnum
channel
lang
dlink
productId

Here mediaUrl is the media attachment link

fromnum is from a phone number, it can be a WhatsApp phone number id in the case of WhatsApp

channel is either whatsapp or SMS

lang is as per language saved in the template, you can find this code in template manager Text Messaging for Marketers and Sales Reps – CRM Messaging (crm-messaging.cloud) for eg. Pass en_US for English(US)

dlink needs to be provided for message templates with dynamic buttons. You can add comma separated values if 2 buttons with dynamic links are setup inh template.

productId is content id of individual product in catalog (eg. z9xo1uzegq)

Response Code :


200 => Sent (Success)
204 => Insufficient Credit
400 => All fields are required
406 => Plan has expired!
401 => Unauthorized
405 => Method Not Allowed
499 => Token Required

Response example:

image 3