📪Send Your First Message
Guide to Sending Your First Message with Waabot API
Step 1: Set Up Your Base URL and Endpoint
The base URL for the Waabot API is:
https://client.waabot.com/api/v2
The endpoint for sending a message is:
/send-message
Step 2: Prepare Your Request Body
To send a message via WhatsApp using the Waabot API, your request body should be structured as follows:
{
"platform": "whatsapp",
"recipient": "**********",
"message": {
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "**********",
"type": "text",
"text": {
"body": "messageText"
}
}
}
Example Request
Here is an example of how to send a simple text message:
{
"platform": "whatsapp",
"recipient": "**********",
"message": {
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "**********",
"type": "text",
"text": {
"body": "Hello, this is your first message from Waabot API!"
}
}
}
Important Note
This message will only be delivered if the user has initiated a conversation with your business number within the last 24 hours. If the user hasn't messaged your business within this timeframe, you will need to use a pre-approved message template to initiate the conversation.
Step 3: Sending a Template Message
To initiate a message to a user who hasn't contacted your business within the last 24 hours, follow these steps:
Create a Template:
Go to your WhatsApp Business Manager.
Create a message template that follows WhatsApp's guidelines.
Submit the template for approval by Facebook.
Send the Template Message:
Once your template is approved, use the Waabot API to send the template message.
Example Request for Template Message
POST https://client.waabot.com/api/v2/send-message
Content-Type: application/json
{
"platform": "whatsapp",
"recipient": "**********",
"message": {
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "**********",
"type": "template",
"template": {
"name": "your_template_name",
"language": {
"code": "en_US"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Hello, this is a template message using Waabot API!"
}
]
}
]
}
}
}
Summary
Direct Messages:
Use the
/send-message
endpoint with the appropriate JSON body to send messages to users who have messaged your business within the last 24 hours.
Template Messages:
Create and get approval for a message template in your WhatsApp Business Manager.
Use the
/send-message
endpoint with the template structure to initiate a conversation with users outside the 24-hour window.
By following these steps, you can effectively send messages and engage with your customers using the Waabot API.
Last updated