IM API

This page contains simple examples for IM API

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

You can send an IM message to the following endpoints using the cURL utility

Curl

Send a simple IM message as SMS

curl -X POST 'https://new.eziapi.com/message' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Basic <TOKEN>' \
    -d '{
        "destination": {
            "mobile": "+64272383189"
        },
        "message": {
            "type": "text",
            "text": {
                "body": "My SMS content"
            }
        }
    }'

Note: if no delivery_attempts field is provided, the delivery channel defaults to sms.

202 response:

{
  "id": "b95fc11e-37f0-4770-a082-6ea22d4c4d12"
}

400 response:

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

Send a simple IM message as WAB with fallback to SMS after 10 seconds

curl -X POST 'https://new.eziapi.com/message' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Basic <TOKEN>' \
    -d '{
        "destination": {
            "mobile": "+64272383189"
        },
        "message": {
            "type": "text",
            "text": {
                "body": "Test"
            }
        },
        "delivery_attempts": [
            {
                "channel": "wab",
                "event":   "received",
                "timeout": 10
            }
            {
                "channel": "sms"
            }
        ]
    }'

Note: the received event means the message was received by the recipient.

Send an IM message with a pre-defined template

    curl -X POST 'https://new.eziapi.com/message' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Basic <TOKEN>' \
    -H 'X-Correlation-Id: f55c5554-87ed-4bde-8991-a2f4a1aa89fb' \
    -d '{
        "destination": {
            "mobile": "+64272383189"
        },
        "message": {
            "type": "template",
            "template": {
                "template_id": "bdff32db-1fd8-4270-99af-1f00c8ffdb3c",
                "parameters": [
                    {
                        "name": "reference",
                        "text": "AZXSNIJN"
                    }
                ]
            }
        },
        "delivery_attempts": [
            {
                "channel": "wab",
                "event":   "read",
                "timeout": 10
            },
            {
                "channel": "sms"
            }
        ]
    }'

Note: the template bdff32db-1fd8-4270-99af-1f00c8ffdb3c accepts one parameter named reference which, in this message, will be replaced with the value: AZXSNIJN.