Skip to content

Messages

The Messages API allows third-party clients to send WhatsApp messages to users using an approved API key.

Base URL for these endpoints: {{baseUrl}}/api/third-party/messages

Environments

We currently provide two environments for our API. Please replace {{baseUrl}} in the examples below with the appropriate URL:

  • Development: https://api.dev.dash.amili.asia
  • Production: https://api.dash.amili.asia

Authentication Required: All endpoints in this section require an active API key passed in the x-api-key header.

Send Text Message

Send a free-text message to a user. This endpoint requires the send:free-text scope.

Endpoint

POST /api/third-party/messages/send-text

Request Body

json
{
  "phone": "+1234567890",
  "text": "Hello, this is a test message!"
}

Example

bash
curl -X POST {{baseUrl}}/api/third-party/messages/send-text \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "text": "Hello, this is a test message!"
  }'

Send Template Message

Send a pre-approved WhatsApp template message to a user. This endpoint requires the send:template scope.

Endpoint

POST /api/third-party/messages/send-template

Request Body

json
{
  "phone": "+1234567890",
  "templateId": "hello_world",
  "language": "en_US",
  "variables": {
    "name": "John Doe"
  },
  "headerVariables": [
    {
      "type": "image",
      "value": null,
      "originalMediaId": "whatsapp_original_media_id"
    }
  ],
  "buttonVariables": [
    {
      "buttonIndex": 0,
      "text": "Visit Website",
      "type": "URL"
    }
  ]
}

Example

bash
curl -X POST {{baseUrl}}/api/third-party/messages/send-template \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "templateId": "hello_world",
    "language": "en_US",
    "variables": {
      "name": "John Doe"
    }
  }'

Send Image Message

Send an image message to a user. This endpoint requires the send:image scope.

To get the mediaId required for this endpoint, refer to the Files API to upload your media and obtain the ID.

Endpoint

POST /api/third-party/messages/send-image

Request Body

json
{
  "phone": "+1234567890",
  "image": {
    "mediaId": "whatsapp_original_media_id",
    "text": "Optional caption for the image"
  }
}

Example

bash
curl -X POST {{baseUrl}}/api/third-party/messages/send-image \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "+1234567890",
    "image": {
      "mediaId": "whatsapp_original_media_id",
      "text": "Optional caption for the image"
    }
  }'