Get Started

Get Started with WhatsApp Business API

This WhatsApp API quickstart walks you through the prerequisites and first steps needed to authenticate and send your first WhatsApp message via the Dexatel API.

Prerequisites

  • A Dexatel account — sign up at https://dashboard.dexatel.com/sign-up/
  • A provisioned WhatsApp Business sender — register one via Senders & Channels in your Dexatel dashboard
  • An API key from your Dexatel dashboard
  • At least one approved WhatsApp message template (for outbound messaging)

Step 1 — Obtain Your API Key

All Dexatel WhatsApp API requests are authenticated using the X-Dexatel-Key header. This authentication step is required before you can send any messages.

To get your key:

  1. Log in to dashboard.dexatel.com
  2. Navigate to API Management → API Keys
  3. Copy your key and store it securely

Security Note

Never expose your API key in client-side code, public repositories, or logs. Treat it like a password. Rotate immediately if compromised.

Step 2 — Verify Your WhatsApp Sender

Before sending, confirm you have at least one active WhatsApp sender:

curl -X GET "https://api.dexatel.com/v1/senders?filter[channel]=WHATSAPP" \
  -H "X-Dexatel-Key: YOUR_API_KEY"

A successful response returns a list of your senders:

{
  "data": [
    {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "account_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "name": "MyBusiness",
      "code": "15551234567",
      "channel": "WHATSAPP",
      "status": "Available",
      "country": "US",
      "create_date": "2024-01-15 09:00:00"
    }
  ],
  "pagination": {
    "number": 1,
    "size": 10,
    "total": 1
  }
}

The name field is the sender identifier used as the from value in message requests. The code field is used as wa_sender_code when creating templates. Only senders with status: "Available" can send messages.

Step 3 — Create a WhatsApp Template

All outbound WhatsApp messages use pre-approved templates. Create your first template:

curl -X POST "https://api.dexatel.com/v1/templates" \
  -H "X-Dexatel-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "name": "welcome_message",
      "channel": "WHATSAPP",
      "wa_sender_code": "15551234567",
      "wa_category": "UTILITY",
      "text": "Hello {first_name}! Welcome to MyBusiness. Reply with any questions.",
      "type": "text"
    }
  }'

The template will be created with status IN_PROCESS while WhatsApp reviews it. Poll GET /v1/templates/{id} until the status is COMPLETED before using it.

Step 4 — Send Your First Message

With an available sender and an approved template, send your first WhatsApp message:

curl -X POST "https://api.dexatel.com/v1/messages" \
  -H "X-Dexatel-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "from": "MyBusiness",
      "to": ["19175550100"],
      "channel": "WHATSAPP",
      "template": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "variables": ["John"]
    }
  }'

A successful response returns HTTP 201 with the message object:

{
  "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "from": "MyBusiness",
  "to": "19175550100",
  "channel": "WHATSAPP",
  "status": "sent",
  "create_date": "2024-01-15 10:30:00"
}

Common Error Codes

1503
Sender missing

Include thefrom field in your request body

1504
Invalid sender

Verify the sender name matches an Available WhatsApp sender

1505
Sender not found

The specified sender does not exist in your account

1506
Recipients missing

Include theto array with at least one phone number

1508
Text required

Provide eithertext or a template reference

1515
Invalid channel

Setchannel to WHATSAPP (case-sensitive)

1532
URL required

Image and video type messages require aurl or media_id

1533
URL and filename required

Document type messages require bothurl (or media_id) and file_name

1705
Invalid payload

Check JSON structure and required field types