Sending WhatsApp messages
In order to send a WhatsApp message, you must have an active WhatsApp channel and perform a HTTP request to the following endpoint with a valid access key
When sending outbound messages as well as setting the receiver information you must set message body field in all cases except for sending a message template when you must only set the template field
Body
Template
If it has been more than 24 hours since a customer last messaged you, you have to start a conversation by sending a template message first. Non-template messages can only be sent when the customer care window is active. You can check the expiry time for an active customer care window for a contact by making a request as follows:
The Channels API supports many of the features of WhatsApp, however due to the omni channel nature of the API there may be some differences between the Channels API message and the native WhatsApp API. Here is an overview of the WhatsApp messages types and Channels API message types:
text
image / sticker
audio / document / video
location
reaction
-
interactive - quick reply button
interactive - list
interactive - multi product message
-
interactive - product
-
contacts
-
replies
template
Outbound messages
Except for the template section all examples below must be set in the body field.
Text
Text Message
Text message with reply buttons
Text message with postback actions
Text message with reply and postback actions
Text message with location request
Image
Single image message
Single image message with text
Multiple image message
Single image message with postback actions
Single image message with label and reply actions
Single image message with label, postback and reply actions
Multiple images message with labels and postback actions
Multiple images message with reply actions
Multiple images message with labels, postback and reply actions
File
Single file message
Single file message with postback and reply actions
Multiple files message
Multiple files message with filename
Multiple files message with two postback actions and a reply action
Location
List
List message without sections
List message with sections
List message with sections and custom button label
ReplyTo
You can send any outbound message as a reply to a previous message by setting the replyTo object as shown below. The replyTo.id should be set to the id of a received message and the replyTo.type should be set to "message"
ReplyTo with a text message
ReplyTo with an image message
ReplyTo with text message with postback actions
Template
Template is the only message type that can be sent by a business to a recipient outside the customer service window, however, a prior opt-in is required. Templates must be active in Studio and, therefore, pre-approved by Meta, before they are used. It's also important to note that the code snippets below must be set in the message template field
Text template with variable
Image template with button and variables
Image with a variable in a button
Last updated