Sending a Message

Sending a Message

We ❤ PHP

At MessageCloud, we love PHP. So much so that we have a prebuilt library available for you to use on our GitHub repository. It makes the integration a cinch!

All requests to send SMS messages should be sent to the following HTTPS URL:

All parameters must be URL-encoded and sent an HTTP GET or POST. A description of the required parameters is given below:

( * required)
Format Description
username * Alphanumeric The username for the campaign.
password * Alphanumeric The password for the campaign.
to * Numeric The phone number to which the SMS should be sent. This should be in MSISDN or international format, e.g. 447528748500
from * Alphanumeric (max. 11 characters) or Numeric The sender ID to use. This can be a phone number, in MSISDN or international format, or an alphanumeric string, up to 11 characters long.
message * Alphanumeric The message content to send
expire_at Date/time The expiry time of the message in ISO 8601 format. If at the time of delivery, the expire_at value is in the past, the message will not be sent.
send_at Date/time The time at which the message should be delivered in ISO 8601 format.

This feature is not supported by all network operators and cannot always be guaranteed. 
dlr_url URL The HTTP URL to which delivery reports for requests will be sent. You can use any custom parameters in the URL query for custom callback IDs, campaign IDs, etc.
dlr_verbosity Numeric The level of delivery reports being requested. Possible values are:

0 = No delivery reports requested
1 = All delivery reports requested, including intermediate reports
2 = Only failed delivery reports requested
3 = Only successful delivery reports requested

HTTP Responses

A JSON-encoded response will be returned which you can interpret to determine the status of your request.

Parameter Format Description
id Alphanumeric The ID of the request. You should include this ID for any support required. The ID will be used in any subsequent delivery reports.
status Alphanumeric A human-readable status that represents the status of the request.
status_code Numeric A numeric code that can be used to represent the status of the problem.

Status Codes

When a request is submitted, the JSON response will contain a status_code parameter which will inform you of the result.

Status Code HTTP Code Description
0 200 The request was successfully submitted.
1 400 The request contained validation errors. See the status field for more information.
2 403 Authentication was not successful.
3 429 The rate limit was exceeded. See the status field for more information.


GET /sms?username=USERNAME&password=PASSWORD&to=447528748500&from=MsgCloud&message=Hello+world HTTP/1.1
User-Agent: curl/7.77.0
Accept: */*

HTTP/1.1 200 OK
Date: Mon, 30 May 2022 16:18:24 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 99
Connection: keep-alive

{"id":"833aa69e1af6496a9441270b64efbe53","status":"Request submitted successfully","status_code":0}