Edgility | API Documentation
15942
page-template-default,page,page-id-15942,ajax_fade,page_not_loaded,,qode-theme-ver-6.0,wpb-js-composer js-comp-ver-4.11.2,vc_responsive
 

API Documentation

Rest API Documentation

Receive Delivery Receipts (Via URL)

Delivery Receipts can be sent to your own End Point

 

Login to MessagePort and click Settings > API

 

Click Handle Delivery Receipts & Replies

 

Enter your Reply / Delivery Receipt URLs and enable the service.

 

Click Save.

 

Any messages sent through your account will now generate a final state delivery receipt that will be sent to your service.

 

The MessagePort application will make a POST request to your end point, it will automatically retry 20 times to push the receipt to your server, if it doesn’t receive a valid response after 20 times it will give up.

 

Method POST

Parameters Description
reference Your reference code provided when submitting the message over the RESTful API.
description The delivery status of your message, this can be one of two optionsDELIVEREDFAILED
time The time that the receipt was generated, will be in the format of;YYYY-MM-DD HH:MM:SS
timezone The timezone of the of the timestamp provided, the timezone is always set to your account timezone for ease.

           

REST Response Headers

When using the REST API to send messages it’s possible to receive any of the below response headers.

 

200 Success

400 Bad Request

402 Payment Required

403 Forbidden

405 Method Not Allowed

406 Not Acceptable

409 Conflict

 

 

200 Success

If the request has been processed the system will issue a 200 Success response.

{“code”:200,”errors”:0,”message”:””}

 

 

400 Bad Request

If the request has extra POST fields is missing a required field or has invalid data supplied in a field the system will issue a 400 Bad Request response.

 

Missing message field

{“code”:400,”message”:”Validation Failed”,”errors”:{“children”:{“message”:{“errors”:[“Messagefield not supplied“]},”number”:[],”senderid”:[],”reference”:[]}}}

 

Extra fields

{“code”:400,”message”:”Validation Failed”,”errors”:{“errors”:[“This form should not contain extra fields.”],”children”:{“message”:[],”number”:[],”senderid”:[],”reference”:[]}}}

 

Invalid phone format (Eg. 6144a333222)

{“code”:400,”message”:”Validation Failed”,”errors”:{“children”:{“message”:[],”number”:{“errors”:[“Number field contains invalid characters“]},”senderid”:[],”reference”:[]}}}

 

 

402 Payment Required

If your account is out of SMS Credits the system will issue a 402 Payment Required response.

{“code”:402,”errors”:402,”message”:”Not enough credits“}

 

 

403 Forbidden

If your API Keys are invalid or disabled the system will issue a 403 Forbidden response.

{“errors”:{“auth”:”Authentication failed.”},”code”:403}

 

 

405 Method Not Allowed

If your application tries to make a GET Request to the API the system will issue a 405 Method Not Allowed response.

{“code”:405,”errors”:405,”message”:”GET Method Not Allowed“}

 

 

406 Not Acceptable

If you try to message a number that is in your Opt Out list the system will issue a 406 Not Acceptable response.

{“code”:406,”errors”:406,”message”:”Number is opted out“}

 

 

409 Conflict

If you try to message a number outside of Australia or New Zealand the system will issue a 409 Conflict response.

{“code”:409,”errors”:409,”message”:”Country not supported“}

Send Message

Sending messages through the MessagePort REST API is quick and easy.

 

Login to your account and click on Settings API. Click Create API Key to generate a new key to use for your application.

 

Now that your API Keys have been generated you can connect to the API.

 

End Point https://messageport.com.au/rest/v1/messages

Method POST

POST Parameters 

number

message

senderid *optional*

reference *optional*

Authentication Basic

 

curl -X POST https://messageport.com.au/rest/v1/messages\

-d “number=61440111222” \

-d “message=Hello World” \

-d “senderid=Edgility” \

-d “reference=APIMessage1” \

-u ‘UNIQUE_ID:UNIQUE_PASSWORD’

 

200 Success

Upon successfully sending a message you’ll get a JSON string returned

 

{“code”:200,”errors”:0,”message”:””}

 

If the ‘code’ in the JSON string or the HTTP Header are equal to 200 then your message has been successfully sent.

 

If you receive any other code or HTTP Header then you’ll receive an error message.

 

View REST Response Headers for a list of API responses

Receive Messages (Via POST URL)

Mobile Originated (Replies) can be sent to your own End Point.

 

Login to MessagePort and click Settings > API Keys.

 

Click Handle Delivery Receipts & Replies

 

Enter your Reply / Delivery Receipt URLs and enable the service.

 

Click Save.

 

Any messages that have replies generated through your account will now forward to service.

 

The MessagePort application will make a POST request to your end point, it will automatically retry 20 times to push the reply to your server, if it doesn’t receive a valid response after 20 times it will give up.

 

Method POST

Parameters

Description
reference Your reference code provided when submitting the message over the RESTful API.
message The message that was sent as a reply 
number The mobile number that sent the reply (International format)
time The time that the receipt was generated, will be in the format of;YYYY-MM-DD HH:MM:SS
timezone The timezone of the of the timestamp provided, the timezone is always set to your account timezone for ease.

Check Balance

Checking your balance through the MessagePort REST API is quick and easy.

Login to your account and click on Settings > API. Click Create API Key to generate a new key to use for your application.

Now that your API Keys have been generated you can connect to the API.

 

End Point https://messageport.com.au/rest/v1/users

Method GET

Authentication Basic

 

curl -X GET https://messageport.com.au/rest/v1/users\

-u ‘UNIQUE_ID:UNIQUE_PASSWORD’

 

200 Success

Upon a successful request you’ll be returned a JSON string.

{“username”: “username@yourdomain.com.au”, “credits”: 100, “senderid”: “Edgility”, “mobile”: “61440111222”, “code”: 200}

If you receive any other code or HTTP Header then you’ll receive an error message.

View REST Response Headers for a list of API responses

Email SMS

Send an email like the following.

 

You can add as many numbers X-CELLPHONE: 04XXXXXXXX

 

So if you want to send to two numbers, 0447100200 and 0447100250 with the message Sample Message

 

The email would look like;

To sms@sms.messageport.com.au

Subject Leave Blank

 

Body

X-CELLPHONE: 0447100200

X-CELLPHONE: 0447100250

 

Sample Message

If you want to use a Sender ID then you need to add X-FROM-CELLPHONE

 

If I want the message coming from Edgility my message would look like;

 

To sms@sms.messageport.com.au

Subject Leave Blank

 

Body

X-CELLPHONE: 0447100200

X-CELLPHONE: 0447100250

X-FROM-CELLPHONE: Edgility

 

Sample Message