Appearance
Text Messages
Convers8 allows you to send simple text messages to your WhatsApp contacts. This guide covers how to use the text messaging API.
Authentication
All API requests must include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYBase URL
https://waba-v1.convers8.africaSending Text Messages
Endpoint
POST /whatsapp/message/text
Request Body
The request body should be a JSON object with the following properties:
| Property | Type | Description |
|---|---|---|
to | string | The recipient's phone number in international format (e.g., +1234567890) |
name | string | The recipient's name |
content | object | An object containing the message content |
content.text | string | The text message to send |
Example Request
json
{
"to": "+1234567890",
"name": "Customer Name",
"content": {
"text": "Hello from Convers8!"
}
}cURL Example
bash
curl --request POST \
--url https://waba-v1.convers8.africa/whatsapp/message/text \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"to": "+1234567890",
"name": "Customer Name",
"content": {
"text": "Hello from Convers8!"
}
}'Response
A successful response will have a 200 status code and a JSON body with the following structure:
json
{
"success": true,
"message": "Message sent successfully",
"data": {
"messageId": "wamid.abcdefghijklmnopqrstuvwxyz"
}
}Error Handling
In case of an error, the API will return a JSON response with an error message:
json
{
"success": false,
"message": "Error message",
"error": {
"code": "error_code",
"details": "Error details"
}
}Common error codes include:
invalid_parameter: One or more parameters in the request are invalidunauthorized: Invalid or missing API keyrate_limit_exceeded: Too many requests in a short periodrecipient_not_found: The recipient's phone number is not registered on WhatsApp
Best Practices
- Message Length: Keep text messages concise and within WhatsApp's character limits.
- Rate Limiting: Be mindful of WhatsApp's rate limits to avoid being blocked.
- Error Handling: Implement proper error handling in your application to manage API errors gracefully.
- Phone Number Format: Always use the international format for phone numbers (e.g., +1234567890).
