Skip to main content

WhatsApp Business API

The WhatsApp Business API through Qlara enables you to send messages to customers at scale with reliable delivery and rich media support. Leverage WhatsApp's massive user base to reach your audience with templates, notifications, and personalized communication.

Overview

WhatsApp integration via Qlara provides two distinct sending modes:

  • Template-based messaging: Send pre-approved templates anytime without time restrictions
  • Free-form messaging: Send custom messages within a 24-hour window after customer engagement

The API supports rich media including text, images, videos, audio files, documents, stickers, locations, and emoji reactions. With configurable fallback chains (WhatsApp → RCS → SMS), you can ensure your messages reach customers even if WhatsApp isn't available.

Authentication

All WhatsApp API requests require authentication using your API key. Include the API key in the X-Api-Key header:

X-Api-Key: your_api_key_here

Sending Messages

Send Endpoint

POST https://lora-api.agiletelecom.com/api/message-server/whatsapp/send

Request Parameters

ParameterTypeRequiredDescription
destinationstringYesRecipient phone number in international format (e.g., +39XXXXXXXXXX)
phoneNumberIdstringYesYour WhatsApp Business phone number ID
templateobjectConditionalTemplate object for approved messages (required if body is not provided)
bodystringConditionalFree-form message text (required if template is not provided; only valid within 24h of customer engagement)
mediaobjectNoMedia content (image, video, audio, document, sticker, location)
fallbackRcsbooleanNoEnable RCS fallback (default: false)
fallbackSmsbooleanNoEnable SMS fallback (default: false)

Template Object

\{
"name": "template_name",
"language": "en",
"parameters": [
"value1",
"value2"
]
\}

Media Types

WhatsApp supports the following media types in your messages:

  • text: Plain text messages
  • image: JPEG and PNG images
  • video: MP4 and 3GPP video files
  • audio: MP3, OGG, and WAV audio files
  • document: PDF and Office documents
  • sticker: Animated and static WebP stickers
  • location: Coordinates with optional label
  • emoji reactions: React to messages with emoji

Fallback Chain

Configure fallback messaging to ensure delivery when WhatsApp is unavailable:

\{
"destination": "+39XXXXXXXXXX",
"phoneNumberId": "your_phone_id",
"body": "Your message",
"fallbackRcs": true,
"fallbackSms": true
\}

If WhatsApp delivery fails:

  1. Message attempts delivery via RCS (if fallbackRcs is enabled)
  2. If RCS unavailable, falls back to SMS (if fallbackSms is enabled)

Managing Phone Numbers

Get Phone Numbers Endpoint

GET https://lora-api.agiletelecom.com/api/message-server/whatsapp/phone-numbers

Retrieve all registered WhatsApp Business phone numbers associated with your account.

Response

\{
"phoneNumbers": [
\{
"id": "phone_number_id",
"phoneNumber": "+39XXXXXXXXXX",
"displayName": "Your Business Name",
"status": "CONNECTED"
\}
]
\}

Response Format

Successful send requests return:

\{
"messageId": "wamid.XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"simulation": false,
"results": [
\{
"destination": "+39XXXXXXXXXX",
"accepted": true
\}
]
\}
FieldTypeDescription
messageIdstringUnique identifier for this message
simulationbooleanIndicates if this was a test/simulation send
resultsarrayArray of per-destination results
acceptedbooleanWhether the destination accepted the message

Templates

Template Management

WhatsApp requires message templates to be approved by Meta before sending. Templates ensure quality and prevent spam.

Template Approval Process

  1. Submit template for review through the API
  2. Meta reviews templates within 24 hours
  3. Once approved, use template name in send requests
  4. You can modify approved templates (requires new approval)

CRUD Operations

Use the following endpoints for template management:

  • Create: POST /api/message-server/whatsapp/templates
  • List: GET /api/message-server/whatsapp/templates
  • Get: GET /api/message-server/whatsapp/templates/{id}
  • Update: PUT /api/message-server/whatsapp/templates/{id}
  • Delete: DELETE /api/message-server/whatsapp/templates/{id}

Use the shortLinkT1 placeholder in your messages to automatically generate short, tracked links:

Your message text with \{shortLinkT1\} placeholder

This enables analytics and click tracking for your campaigns.

Code Examples

curl -X POST https://lora-api.agiletelecom.com/api/message-server/whatsapp/send \
-H "X-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '\{
"destination": "+39XXXXXXXXXX",
"phoneNumberId": "your_phone_id",
"body": "Hello from Qlara!"
\}'

Webhooks & Delivery

Delivery Status

Monitor message delivery through webhooks configured in your account settings.

Status Codes

CodeStatusDescription
3DeliveredMessage successfully delivered to WhatsApp servers
6UndeliverableMessage could not be delivered to recipient

Webhook Payloads

Your callback URL receives delivery confirmations with detailed status information:

\{
"messageId": "wamid.XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"destination": "+39XXXXXXXXXX",
"status": 3,
"timestamp": "2024-01-15T10:30:45Z"
\}

Best Practices

  • Use templates for time-sensitive and promotional messages to ensure consistent approval and anytime sending
  • Leverage fallback chains to maximize delivery rates across channels
  • Monitor webhook callbacks to track message delivery in real-time
  • Test templates during development to ensure proper variable substitution
  • Keep phone numbers accurate and up-to-date in your system
  • Use tracked links for campaign analytics and performance measurement
  • Respect the 24-hour message window for free-form messages after customer interaction