/v1/messages
Use the messages
node to send text messages to your customers.
You will need:
Once you have the WhatsApp ID for the user you want to message, use it to send a text message.
Note: A text message can be a max of 4096 characters long.
POST /v1/messages { "preview_url": false | true, "recipient_type": "individual", "to": "whatsapp-id", "type": "text", "text": { "body": "your-text-message-content" } }
Name | Required | Description |
---|---|---|
| No | Allows for URL previews in messages.
Values: |
| No | Value: |
| Yes | The WhatsApp ID returned from the |
| No | Value: |
| Yes | Contains the |
text
objectName | Required | Description |
---|---|---|
| Yes | The text of the text message, which can contain URLs and formatting |
By default, the mobile WhatsApp application recognizes URLs and makes them clickable. To include a URL preview, include "preview_url": true
in the message body and make sure the URL begins with http://
or https://
. A hostname is required, IP addresses are not matched.
{ "preview_url": true, "to": "whatsapp-id", "text": { "body": "You have to check out this amazing messaging service https://www.whatsapp.com/" }
The majority of the time when you send a URL, whether with a preview or not, the receiver of the message will see a URL that they can click on.
URL previews will only be rendered after one of the following has happened:
WhatsApp allows some formatting in messages. To format all or part of a message, use these formatting symbols:
Formatting | Symbol | Example |
---|---|---|
Bold | Asterisk (*) | Your total is *$10.50*. |
Italics | Underscore (_) | Welcome to _WhatsApp_! |
Tilde (~) | This is ~better~ best! | |
| Three backticks (```) | ```print 'Hello World';``` |
A successful response includes a messages
object with an ID for the newly created message.
{ "messages": [{ "id": "gBEGkYiEB1VXAglK1ZEqA1YKPrU" }] }
An unsuccessful response will contain an error message. See Error and Status Codes for more information.