WhatsAppTemplate Messaging

WhatsApp Template Messaging API

Send single and bulk WhatsApp messages using pre-approved templates via the ChumiAI API.

Prerequisite

You must create and get approval for your WhatsApp templates in your ChumiAI account dashboard before you can send them via the API. Templates created directly in Meta Business Suite must be synced to ChumiAI first.

1. Sending a Single Template Message

Use this endpoint to send a template message to a single recipient.

POST/api/v1/whatsapp/send-template
Authentication:X-API-Keyheader required

Request Body (application/json)

FieldTypeRequiredDescription
tostringYesRecipient phone number in international format (e.g., 233244123456).
templateNamestringYesThe exact name of the approved template in ChumiAI.
languageCodestringNoLanguage code (default: en_US).
templateParametersarrayNoList of parameters to fill in the template placeholders (e.g., {{1}}, {{2}}).
headerMediaIdstringNoWhatsApp Media ID for templates with media headers.
headerMediaUrlstringNoPublic URL of the media for templates with media headers.

Example Request

bash
curl -X POST "https://api.chumiai.app/api/v1/whatsapp/send-template" \
     -H "X-API-Key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "to": "233244123456",
       "templateName": "welcome_message",
       "languageCode": "en_US",
       "templateParameters": [
         { "text": "John" },
         { "text": "CHUMI-2024" }
       ]
     }'

2. Bulk Template Messages (Excel/CSV Import)

Send messages to multiple recipients by uploading a file. This creates an asynchronous background job.

POST/api/v1/whatsapp/bulk-import-messages
Authentication:X-API-Key
Content-Type:multipart/form-data

Form Fields

FieldTypeRequiredDescription
filefileYesExcel (.xlsx, .xls) or CSV file containing recipient data.
templateNamestringYesThe name of the template to use.
languageCodestringNoLanguage code (default: en_US).

File Format

  • The first column must be the phone numbers.
  • Subsequent columns should contain data for the template parameters in order ({{1}}, {{2}}, etc.).

Example Request

bash
curl -X POST "https://api.chumiai.app/api/v1/whatsapp/bulk-import-messages" \
     -H "X-API-Key: YOUR_API_KEY" \
     -F "file=@recipients.xlsx" \
     -F "templateName=promotion_broadcast" \
     -F "languageCode=en_US"

3. Bulk Template Messages (Contact Groups)

Send a template to all contacts in a specific ChumiAI contact group.

POST/api/v1/whatsapp/send-template-to-group
Authentication:X-API-Keyheader required

Request Body (application/json)

FieldTypeRequiredDescription
groupIdstring (GUID)YesThe ID of the contact group.
templateNamestringYesThe name of the template.
languageCodestringNoLanguage code (default: en_US).
parameterDefaultsobjectNoDefault values for parameters (e.g., {"1": "Customer"}).

Example Request

bash
curl -X POST "https://api.chumiai.app/api/v1/whatsapp/send-template-to-group" \
     -H "X-API-Key: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "groupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
       "templateName": "monthly_newsletter",
       "parameterDefaults": {
         "1": "Valued Member"
       }
     }'

4. Monitoring Bulk Jobs

Since bulk operations run in the background, use these endpoints to check progress.

Get Job Status

GET/api/v1/whatsapp/bulk-jobs/{jobId}/status

Get Job History

GET/api/v1/whatsapp/bulk-jobs?page=1&pageSize=20

Example Response

json
{
  "jobId": "...",
  "status": "Processing",
  "totalRecipients": 500,
  "successfullySent": 120,
  "failed": 2,
  "progressPercentage": 24.4
}

500

Total

120

Sent

2

Failed

24.4%

Progress