How to setup WhatsApp message templates?
- Getting Started
- Bot Building
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- Agent Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Table of Contents
You can have the bot initiate a conversation with the user. This is done by sending them a pre-approved message template, previously called HSM.
WhatsApp Message Templates
Message templates are messages with placeholders for sending dynamic data. All templates need to be approved by WhatsApp before they can be sent to the user.
You can read more about the WhatsApp message template here.
Here’s a sample message template:
After filling in user-specific data the message template will be sent out as:
How to send Message Templates?
There are 2 major steps involved in this process:
Step 1 - Create a message template
The first step is to create a message template according to WhatsApp guidelines and request approval. Only approved messages can be sent to users and the approval process can take 1-2 weeks. You can read more about creating message templates here.
At any time, you can send message templates to customers who have opted-in. You can read more about business-initiated messages here and opt-ins here.
Step 2 - Send the message template
When the business wants to send a message template, they make an API request to Conversation Studio with the WhatsApp number, the template id, and the data to be filled in the template. Conversation Studio then fetches the WhatsApp id for the number and if that is found, it sends a request to the WhatsApp server instance with the template id, WhatsApp id, and the data for the template. The WhatsApp server instance then sends the message template to the user.
API REQUEST
The default request signature for sending a text message is as shown below. To send other types of messages, you can read here.
In the request body, business_id, token, account_id, and template details will be provided by Haptik.
curl --location --request POST <BASE_URL>/whatsapp/notification/v2/' \ --header 'Content-Type: application/json' \ --header 'Account-Id: <Account_Id>' \ --header 'Authorization: Bearer <authentication_token>' \ --data-raw '{ "business_id":<ID of the business as a number>, "to":<phone_number>, "type":"template", "template":{ "namespace":<from whatsapp dashboard>, "name":<name of the template>, "language":{ "policy":"deterministic", "code":"en" }, "components": [{ "type": "body", "parameters": [ { "type": "text", "text": "<Param 1 value>" } ] }] } }'
API RESPONSE
When the API call is successful, you will get the below response. This means the Notifications API was triggered and WhatsApp sent the message to a defined number. The delivery to the recipient is not guaranteed by WhatsApp.
{ "meta": { "api_status": "stable", "version": "<whatsapp version>" }, "messages": [{ "id": "<random message id>" }] }
When the API call is unsuccessful, you will get the below response. You can refer to this for getting more information on the error received.
{ "meta": { "api_status": "stable", "version": "<whatsapp version>" }, "errors": [ { "code": <error code>, "title": "<code title>", "details": "<error details>" } ] }
FAQs
1. I keep getting "unable to verify contact details" in response even though the Mobile Number entered is a valid WhatsApp account. This could happen because of the following reasons:
- If the credentials entered in your Bot's Business Manager are incorrect.
- If you have not specified the Country code in the to field when sending the message template and if it is different from the Country Code used when setting up the WhatsApp Number.
2. What are the acceptable formats for phone numbers?
You can read here about all the acceptable formats.
3. Where do I check the message statistics?
Sent vs Delivered messages statistics are available on the WhatsApp dashboard.