WhatsApp API

This page contains simple examples for WhatsApp API

This API has been developed in accordance with the OpenAPI specification defined here.

You can send a WhatsApp message to the following endpoints using the cURL utility

Curl

POST /messages is the endpoint to send (create) new whatsapp MT messages

curl -X POST \
  --url https://api.modicagroup.com/rest/wab/v1/messages \
  -H 'accept: application/json' \
  -H 'authorization: Basic <token>' \
  -H 'content-type: application/json' \
  -D '{
  "destination": "+64123456879",
  "type": "text",
  "text": {
    "body": "Hello"
  },
  "source": "1234567890"
}'

202 response:

[
  {
  "id": "b95fc11e-37f0-4770-a082-6ea22d4c4d12",
  "status": "accepted",
  "reference": ""
  }
]

400 response:

{
  "error": "bad request error message",
  "message": "Whatsapp Cloud API error",
  "statusCode": 400
}

POST /messages/broadcast

curl \
  -X POST 'https://api.modicagroup.com/rest/wab/v1/messages/broadcast' \
  -H 'accept: application/json' \
  -H 'authorization: Basic <token>' \
  -H 'content-type: application/json' \
  -D '{
  "destination": [
    "+64123456789",
    "+64223456788"
  ],
  "type": "text",
  "text": {
    "body": "Hello"
  },
  "source": "1234567890"
}'

202 response:

[
  {
    "destination": "+64123456789",
    "id": "a6c566d8-59f8-4187-9906-c296ae41bf13",
    "status": "accepted"
  },
  {
    "destination": "+64223456788",
    "id": "cd415c6d-2fe8-4cb0-b5d7-135674fcf5e5",
    "status": "accepted"
  }
]

POST \media

curl \
 -X POST 'https://api.modicagroup.com/rest/wab/v1/media?source=string' \
  -H 'accept: application/json' \
  -H 'authorization: Basic <token>' \
  -H 'x-xsrf-token: string' \
  -F file=string

200 response:

[
  {
    "id": "string"
  }
]

422 response:

{
  "errors": [
    {
      "field": "",
      "code": "",
      "description": "Unprocessable Entity"
    }
  ]
}