Skip to content

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_KEY

Base URL

https://waba-v1.convers8.africa

Sending Text Messages

Endpoint

POST /whatsapp/message/text

Request Body

The request body should be a JSON object with the following properties:

PropertyTypeDescription
tostringThe recipient's phone number in international format (e.g., +1234567890)
namestringThe recipient's name
contentobjectAn object containing the message content
content.textstringThe 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 invalid
  • unauthorized: Invalid or missing API key
  • rate_limit_exceeded: Too many requests in a short period
  • recipient_not_found: The recipient's phone number is not registered on WhatsApp

Best Practices

  1. Message Length: Keep text messages concise and within WhatsApp's character limits.
  2. Rate Limiting: Be mindful of WhatsApp's rate limits to avoid being blocked.
  3. Error Handling: Implement proper error handling in your application to manage API errors gracefully.
  4. Phone Number Format: Always use the international format for phone numbers (e.g., +1234567890).