NAV Navigation
Shell HTTP JavaScript Node.js Ruby Python Java Go PHP

Intelligent Messaging API v0.0.1

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

This is the Intelligent Messaging API for sending messages with automated fallback to other delivery channels.

Base URLs:

Terms of service Email: API Support Web: API Support License: Modica API - Terms Of Use

Authentication

messages

Messaging endpoints.

message_post

Code samples

# You can also use wget
curl -X POST https://new.eziapi.com/rest/im/v1/message \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'authorization: API_KEY'

POST https://new.eziapi.com/rest/im/v1/message HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "destination": {
    "contact_id": "stringstringstringstringstringstring",
    "mobile": "string",
    "email": "user@example.com"
  },
  "message": {
    "type": "text",
    "text": {
      "body": "string"
    },
    "media": {
      "type": "image/png",
      "url": "https://www.luckyshrub.com/assets/succulents/aloe.png"
    },
    "template": {
      "template_id": "otp_wab_template"
    }
  },
  "delivery_attempts": [
    {
      "firstdeliveryattempt": {
        "channel": "wab",
        "event": "read",
        "timeout": 15
      }
    }
  ],
  "reference": "string",
  "scheduler_pipe": "dynamic"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'authorization':'API_KEY'
};

fetch('https://new.eziapi.com/rest/im/v1/message',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

const fetch = require('node-fetch');
const inputBody = {
  "destination": {
    "contact_id": "stringstringstringstringstringstring",
    "mobile": "string",
    "email": "user@example.com"
  },
  "message": {
    "type": "text",
    "text": {
      "body": "string"
    },
    "media": {
      "type": "image/png",
      "url": "https://www.luckyshrub.com/assets/succulents/aloe.png"
    },
    "template": {
      "template_id": "otp_wab_template"
    }
  },
  "delivery_attempts": [
    {
      "firstdeliveryattempt": {
        "channel": "wab",
        "event": "read",
        "timeout": 15
      }
    }
  ],
  "reference": "string",
  "scheduler_pipe": "dynamic"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'authorization':'API_KEY'
};

fetch('https://new.eziapi.com/rest/im/v1/message',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'authorization' => 'API_KEY'
}

result = RestClient.post 'https://new.eziapi.com/rest/im/v1/message',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'authorization': 'API_KEY'
}

r = requests.post('https://new.eziapi.com/rest/im/v1/message', headers = headers)

print(r.json())

URL obj = new URL("https://new.eziapi.com/rest/im/v1/message");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "authorization": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/im/v1/message", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
    'authorization' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://new.eziapi.com/rest/im/v1/message', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

POST /message

Send a message with automated fallback to other delivery channels.

Send a message with automated fallback to other delivery channels.

Body parameter

{
  "destination": {
    "contact_id": "stringstringstringstringstringstring",
    "mobile": "string",
    "email": "user@example.com"
  },
  "message": {
    "type": "text",
    "text": {
      "body": "string"
    },
    "media": {
      "type": "image/png",
      "url": "https://www.luckyshrub.com/assets/succulents/aloe.png"
    },
    "template": {
      "template_id": "otp_wab_template"
    }
  },
  "delivery_attempts": [
    {
      "firstdeliveryattempt": {
        "channel": "wab",
        "event": "read",
        "timeout": 15
      }
    }
  ],
  "reference": "string",
  "scheduler_pipe": "dynamic"
}

Parameters

Name In Type Required Description
body body MessagePostRequest false none

Example responses

202 Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

400 Response

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

401 Response

{
  "message": "API unauthorized error",
  "statusCode": 401,
  "error": "unauthorized error message"
}

404 Response

{
  "message": "API not found error",
  "statusCode": 404,
  "error": "not found error message"
}

422 Response

{
  "message": "API unprocessable entity error",
  "statusCode": 422,
  "error": "unprocessable entity error message"
}

429 Response

{
  "message": "API too many requests error",
  "statusCode": 429,
  "error": "too many requests error message"
}

500 Response

{
  "message": "API internal server error",
  "statusCode": 500,
  "error": "internal server error message"
}

Responses

Status Meaning Description Schema
202 Accepted Successful Post Message response structure. Inline
400 Bad Request Invalid request data. This response is returned when the request data is invalid or improperly formatted. APIError
401 Unauthorized Unauthorized. This response is returned when the user is not authorized to perform the requested action. APIError
404 Not Found Not Found. This response indicates that the requested resource was not found. APIError
422 Unprocessable Entity Unprocessable Entity. This response is returned when the request data is correct but cannot be processed. APIError
429 Too Many Requests Too Many Requests. This response indicates that the client has exceeded the rate limits. APIError
500 Internal Server Error Internal server error. This response is returned when an internal server error occurs. APIError

Response Schema

Status Code 202

Name Type Required Restrictions Description
» id Uuid false none A random UUID - version 4.

Callbacks

messageCallback

{$statusCallbackUrl}

message_post

Code samples

# You can also use wget
curl -X POST https://new.eziapi.com/rest/im/v1/message \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'authorization: API_KEY'

POST https://new.eziapi.com/rest/im/v1/message HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
  "detail": "ref-abc123",
  "status": "received"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'authorization':'API_KEY'
};

fetch('https://new.eziapi.com/rest/im/v1/message',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

const fetch = require('node-fetch');
const inputBody = {
  "id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
  "detail": "ref-abc123",
  "status": "received"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'authorization':'API_KEY'
};

fetch('https://new.eziapi.com/rest/im/v1/message',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'authorization' => 'API_KEY'
}

result = RestClient.post 'https://new.eziapi.com/rest/im/v1/message',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'authorization': 'API_KEY'
}

r = requests.post('https://new.eziapi.com/rest/im/v1/message', headers = headers)

print(r.json())

URL obj = new URL("https://new.eziapi.com/rest/im/v1/message");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "authorization": []string{"API_KEY"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/im/v1/message", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
    'authorization' => 'API_KEY',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://new.eziapi.com/rest/im/v1/message', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

POST /message

Status/DLR callback

Sent when the status of a MT message is updated

Body parameter

{
  "id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
  "detail": "ref-abc123",
  "status": "received"
}

Parameters

Name In Type Required Description
body body StatusCallback false Status callback payload

Example responses

401 Response

{
  "message": "API unauthorized error",
  "statusCode": 401,
  "error": "unauthorized error message"
}

429 Response

{
  "message": "API too many requests error",
  "statusCode": 429,
  "error": "too many requests error message"
}

500 Response

{
  "message": "API internal server error",
  "statusCode": 500,
  "error": "internal server error message"
}

Responses

Status Meaning Description Schema
200 OK callback successfully processed None
401 Unauthorized Unauthorized. This response is returned when the user is not authorized to perform the requested action. APIError
429 Too Many Requests Too Many Requests. This response indicates that the client has exceeded the rate limits. APIError
500 Internal Server Error Internal server error. This response is returned when an internal server error occurs. APIError

Response Headers

Status Header Type Format Description
200 X-RateLimit-Limit integer int32 Requests per second limit.

Schemas

MessagePostRequest

{
  "destination": {
    "contact_id": "stringstringstringstringstringstring",
    "mobile": "string",
    "email": "user@example.com"
  },
  "message": {
    "type": "text",
    "text": {
      "body": "string"
    },
    "media": {
      "type": "image/png",
      "url": "https://www.luckyshrub.com/assets/succulents/aloe.png"
    },
    "template": {
      "template_id": "otp_wab_template"
    }
  },
  "delivery_attempts": [
    {
      "firstdeliveryattempt": {
        "channel": "wab",
        "event": "read",
        "timeout": 15
      }
    }
  ],
  "reference": "string",
  "scheduler_pipe": "dynamic"
}

Message Send Request

Properties

Name Type Required Restrictions Description
destination Destination true none none
message Message true none none
delivery_attempts [DeliveryAttempt] false none [Sequence of channel delivery attempts.]
reference string(none) false none none
scheduler_pipe SchedulerPipe false none The scheduler pipe can be specified here.

Destination

{
  "contact_id": "stringstringstringstringstringstring",
  "mobile": "string",
  "email": "user@example.com"
}

Destination

Properties

Name Type Required Restrictions Description
contact_id Uuid false none A random UUID - version 4.
mobile E164 false none The destination number in E.164 format.
email Email false none An email address.

Source

{
  "source_id": "stringstringstringstringstringstring",
  "channel_sources": [
    {
      "channel": "email",
      "source": "im-email@modicagroup.com"
    }
  ]
}

Source

Properties

Name Type Required Restrictions Description
source_id Uuid false none A random UUID - version 4.
channel_sources [ChannelSource] false none [The source for this channel.]

SchedulerPipe

"dynamic"

The scheduler pipe can be specified here.

Properties

Name Type Required Restrictions Description
anonymous string false none The scheduler pipe can be specified here.

Enumerated Values

Property Value
anonymous dynamic
anonymous eventbridge
anonymous sqs

ChannelSource

{
  "channel": "email",
  "source": "im-email@modicagroup.com"
}

The source for this channel.

Properties

Name Type Required Restrictions Description
channel Channel true none none
source string true none none

Message

{
  "type": "text",
  "text": {
    "body": "string"
  },
  "media": {
    "type": "image/png",
    "url": "https://www.luckyshrub.com/assets/succulents/aloe.png"
  },
  "template": {
    "template_id": "otp_wab_template"
  }
}

Message

Properties

Name Type Required Restrictions Description
type MessageType true none none
text TextMessage false none none
media MediaMessage false none none
template TemplateMessage false none none

TextMessage

{
  "body": "string"
}

Content of a Text message.

Properties

Name Type Required Restrictions Description
body LongString true none A generic long string format.

MediaMessage

{
  "type": "image/png",
  "url": "https://www.luckyshrub.com/assets/succulents/aloe.png"
}

Content of a Media message.

Properties

Name Type Required Restrictions Description
type MimeType true none none
url Url true none none

TemplateMessage

{
  "template_id": "otp_wab_template"
}

Content of a Template message.

Properties

Name Type Required Restrictions Description
template_id Uuid true none A random UUID - version 4.
language string false none none
parameters [TemplateParameter] false none [The text value that will replace the parameter in the template.]

TemplateParameter

{
  "name": "otp_code",
  "text": "458972"
}

The text value that will replace the parameter in the template.

Properties

Name Type Required Restrictions Description
name ShortString true none Name of the template parameter.
text string(none) true none Value of the template parameter.

DeliveryAttempt

{
  "firstdeliveryattempt": {
    "channel": "wab",
    "event": "read",
    "timeout": 15
  }
}

Sequence of channel delivery attempts.

Properties

Name Type Required Restrictions Description
channel Channel true none none
event ShortString false none A generic short string format.
timeout integer(int32) false none timeout in seconds.

Channel

"wab"

Properties

Name Type Required Restrictions Description
anonymous string false none none

Enumerated Values

Property Value
anonymous wab
anonymous sms
anonymous mms
anonymous email
anonymous rcs

MessageType

"text"

Properties

Name Type Required Restrictions Description
anonymous string false none none

Enumerated Values

Property Value
anonymous text
anonymous media
anonymous template

MimeType

"string"

Properties

Name Type Required Restrictions Description
anonymous string false none none

E164

"string"

The destination number in E.164 format.

Properties

Name Type Required Restrictions Description
anonymous string false none The destination number in E.164 format.

APIError

{
  "code": 200,
  "message": "string",
  "errors": [
    {
      "field": "string",
      "code": 200,
      "description": "string"
    }
  ]
}

APIError

Properties

Name Type Required Restrictions Description
code integer(int32) false none none
message LongString false none A generic long string format.
errors [Error] false none [A generic error object.]

Error

{
  "field": "string",
  "code": 200,
  "description": "string"
}

Error

Properties

Name Type Required Restrictions Description
field ShortString false none A generic short string format.
code integer(int64) false none none
description LongString true none A generic long string format.

LongString

"string"

A generic long string format.

Properties

Name Type Required Restrictions Description
anonymous string false none A generic long string format.

ShortString

"string"

A generic short string format.

Properties

Name Type Required Restrictions Description
anonymous string false none A generic short string format.

Url

"string"

Properties

Name Type Required Restrictions Description
anonymous string(url) false none none

Uuid

"stringstringstringstringstringstring"

A random UUID - version 4.

Properties

Name Type Required Restrictions Description
anonymous string false none A random UUID - version 4.

Email

"user@example.com"

An email address.

Properties

Name Type Required Restrictions Description
anonymous string(email) false none An email address.

StatusCallback

{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "detail": "string",
  "status": "accepted"
}

Status callback structure.

Properties

Name Type Required Restrictions Description
id string(uuid) false none none
detail string(none) false none none
status string false none none

Enumerated Values

Property Value
status accepted
status submitted
status sent
status received
status read
status frozen
status rejected
status failed
status dead
status expired