Messages
PHP

Introduction

CM's Messages API enables you to send individual messages or message campaigns . You can integrate this in your application by communicating with our api.

The Messages API is a REST API that uses JSON to communicate.

Authentication

Authentication and authorization is done via a product token. You can obtain your product token from the messaging gateway app (https://gateway.cmtelecom.com). If you don't see that app you might have got it via your account manager or you can contact support to obtain one.

For all methods described in this api, the product token should be provided by including it in the X-CM-PRODUCTTOKEN header.

Getting your accountID

In all methods you need to provide the accountId. This is a guid that identifies your account. This identifier can be found on the url of the addressbook application (https://addressbook.cmtelecom.com), after the language indicator. Below you can find some url examples and the corresponding accountId.

Url AccountID
https://addressbook.cmtelecom.com/en/a66b6ba2-7b13-4caf-abf6-c736c977c1d4 a66b6ba2-7b13-4caf-abf6-c736c977c1d4
https://addressbook.cmtelecom.com/fr/fe266716-d8ff-4aba-bddb-c61f8f40c656 fe266716-d8ff-4aba-bddb-c61f8f40c656

Channels

GetChannels

Gets available channels.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/channels

GET Parameters

name in description required type format
accountId path The accountId. true string uuid

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/channels
     -X GET
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/channels';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

Messages

GetMessages

Gets Messages paged.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages

GET Parameters

name in description required type format items collectionFormat
accountId path The account id. true string uuid
status query Message status id. false string
orderby query Column names (date, price, recipients, name) to order messages. add desc to

order descending (ex: date desc) |false |array | |

  • "string"
|multi | | skip |query |The skip. |false |integer |int32 | | | | take |query |The take. |false |integer |int32 | | |

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages?status='status'&orderby='orderby'&skip=10&take=10
     -X GET
     -H "Content-Type: application/json"
     -d "'string'"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages?status='status'&orderby='orderby'&skip=10&take=10';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

AddMessage

Adds a Message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages

POST Parameters

name in description required type format schema
accountId path The accountId. true string uuid
message body The Message. true
  • {
    • "body" : "string",
    • "channels" : {
      • "name" : "string",
      • "type" : "string",
      • "value" : "string"
      }, "countrySpecificSenders" : {
      • "description" : "Gets or sets the senders.",
      • "type" : "object",
      • "additionalProperties" : "string"
      }, "ignoreUnsubscribes" : {
      • "description" : "Gets or sets the ignore unsubscribes setting.",
      • "type" : "boolean"
      }, "name" : "string",
    • "recipients" : {
      • "contact" : "string",
      • "data" : {
        • "description" : "Gets or sets the json data for recipient.",
        • "type" : "object",
        • "additionalProperties" : "string"
        }, "group" : "string",
      • "msisdn" : "string"
      }, "recurrence" : "string",
    • "scheduledAtUtc" : "string",
    • "senderPreset" : "string",
    • "senders" : {
      • "type" : "string"
      }, "spread" : {
      • "timeFrames" : {
        • "days" : {
          • "type" : "string"
          }, "startTime" : "string",
        • "endTime" : "string"
        }, "until" : "string"
      }, "status" : "string"
    }

Responses

http status description
201 Created

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages
     -X POST
     -H "Content-Type: application/json"
     -d "{
 'body' : 'string',
 'channels' : {
  'name' : 'string',
  'type' : 'string',
  'value' : 'string'
 },
 'countrySpecificSenders' : {
  'description' : 'Gets or sets the senders.',
  'type' : 'object',
  'additionalProperties' : 'string'
 },
 'ignoreUnsubscribes' : {
  'description' : 'Gets or sets the ignore unsubscribes setting.',
  'type' : 'boolean'
 },
 'name' : 'string',
 'recipients' : {
  'contact' : 'string',
  'data' : {
   'description' : 'Gets or sets the json data for recipient.',
   'type' : 'object',
   'additionalProperties' : 'string'
  },
  'group' : 'string',
  'msisdn' : 'string'
 },
 'recurrence' : 'string',
 'scheduledAtUtc' : 'string',
 'senderPreset' : 'string',
 'senders' : {
  'type' : 'string'
 },
 'spread' : {
  'timeFrames' : {
   'days' : {
    'type' : 'string'
   },
   'startTime' : 'string',
   'endTime' : 'string'
  },
  'until' : 'string'
 },
 'status' : 'string'
}"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'data' => json_encode(array(
               "body" => "string",
               "channels": array(
                "name" => "string",
                "type" => "string",
                "value" => "string"
               ),
               "countrySpecificSenders": array(
                "description" => "Gets or sets the senders.",
                "type" => "object",
                "additionalProperties" => "string"
               ),
               "ignoreUnsubscribes": array(
                "description" => "Gets or sets the ignore unsubscribes setting.",
                "type" => "boolean"
               ),
               "name" => "string",
               "recipients": array(
                "contact" => "string",
                "data": array(
                 "description" => "Gets or sets the json data for recipient.",
                 "type" => "object",
                 "additionalProperties" => "string"
                ),
                "group" => "string",
                "msisdn" => "string"
               ),
               "recurrence" => "string",
               "scheduledAtUtc" => "string",
               "senderPreset" => "string",
               "senders": array(
                "type" => "string"
               ),
               "spread": array(
                "timeFrames": array(
                 "days": array(
                  "type" => "string"
                 ),
                 "startTime" => "string",
                 "endTime" => "string"
                ),
                "until" => "string"
               ),
               "status" => "string"
              )          )
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_POST           => true,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

DeleteMessages

Deletes multiple Messages.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages

DELETE Parameters

name in description required type format items collectionFormat
accountId path The accountId. true string uuid
messageIds query The identifier. false array
  • "string"
multi

Responses

http status description
204 NoContent

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages?messageIds='messageIds'
     -X DELETE
     -H "Content-Type: application/json"
     -d "'string'"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages?messageIds='messageIds'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_CUSTOMREQUEST  => 'DELETE',
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

CancelMessage

Cancels a message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/cancel

POST Parameters

name in description required type format
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/cancel
     -X POST
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId
         .'/cancel';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

GetMessage

Gets a Message by id.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}

GET Parameters

name in description required type format
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}
     -X GET
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId;

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

UpdateMessage

Updates a Message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}

PUT Parameters

name in description required type format schema
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid
message body The Message. true
  • {
    • "body" : "string",
    • "channels" : "string",
    • "countrySpecificSenders" : {
      • "description" : "Gets or sets the senders.",
      • "type" : "object",
      • "additionalProperties" : "string"
      }, "ignoreUnsubscribes" : {
      • "description" : "Gets or sets the ignore unsubscribes setting.",
      • "type" : "boolean"
      }, "name" : "string",
    • "recipients" : {
      • "contact" : "string",
      • "data" : {
        • "description" : "Gets or sets the json data for recipient.",
        • "type" : "object",
        • "additionalProperties" : "string"
        }, "group" : "string",
      • "msisdn" : "string"
      }, "recurrence" : "string",
    • "scheduledAtUtc" : "string",
    • "senderPreset" : "string",
    • "senders" : "string",
    • "spread" : {
      • "timeFrames" : {
        • "days" : "string",
        • "startTime" : "string",
        • "endTime" : "string"
        }, "until" : "string"
      }, "status" : "string"}

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}
     -X PUT
     -H "Content-Type: application/json"
     -d "{
 'body' : 'string',
 'channels' : 'string',
 'countrySpecificSenders' : {
  'description' : 'Gets or sets the senders.',
  'type' : 'object',
  'additionalProperties' : 'string'
 },
 'ignoreUnsubscribes' : {
  'description' : 'Gets or sets the ignore unsubscribes setting.',
  'type' : 'boolean'
 },
 'name' : 'string',
 'recipients' : {
  'contact' : 'string',
  'data' : {
   'description' : 'Gets or sets the json data for recipient.',
   'type' : 'object',
   'additionalProperties' : 'string'
  },
  'group' : 'string',
  'msisdn' : 'string'
 },
 'recurrence' : 'string',
 'scheduledAtUtc' : 'string',
 'senderPreset' : 'string',
 'senders' : 'string',
 'spread' : {
  'timeFrames' : {
   'days' : 'string',
   'startTime' : 'string',
   'endTime' : 'string'
  },
  'until' : 'string'
 },
 'status' : 'string'
}"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId',
    'data' => json_encode(array(
               "body" => "string",
               "channels" => "string",
               "countrySpecificSenders": array(
                "description" => "Gets or sets the senders.",
                "type" => "object",
                "additionalProperties" => "string"
               ),
               "ignoreUnsubscribes": array(
                "description" => "Gets or sets the ignore unsubscribes setting.",
                "type" => "boolean"
               ),
               "name" => "string",
               "recipients": array(
                "contact" => "string",
                "data": array(
                 "description" => "Gets or sets the json data for recipient.",
                 "type" => "object",
                 "additionalProperties" => "string"
                ),
                "group" => "string",
                "msisdn" => "string"
               ),
               "recurrence" => "string",
               "scheduledAtUtc" => "string",
               "senderPreset" => "string",
               "senders" => "string",
               "spread": array(
                "timeFrames": array(
                 "days" => "string",
                 "startTime" => "string",
                 "endTime" => "string"
                ),
                "until" => "string"
               ),
               "status" => "string"
              )          )
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId;

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_CUSTOMREQUEST  => 'PUT',
     CURLOPT_POST           => true,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

DeleteMessage

Deletes a Message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}

DELETE Parameters

name in description required type format
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid

Responses

http status description
204 NoContent

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}
     -X DELETE
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId;

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_CUSTOMREQUEST  => 'DELETE',
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

DuplicateMessage

Duplicates a Message and returns the new message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/duplicate

POST Parameters

name in description required type format
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid
duplicateAs query Specifies if message should be duplicated as a template or a draft. true string

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/duplicate?duplicateAs='duplicateAs'
     -X POST
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId
         .'/duplicate?duplicateAs='duplicateAs'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

GetMessageCost

Gets cost estimation for specified message

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/cost

GET Parameters

name in description required type format
accountId path The accountId. true string uuid
messageId path The group ids to fetch true string uuid

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/cost
     -X GET
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId
         .'/cost';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

PauseMessage

Pause sending a message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/pause

POST Parameters

name in description required type format
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/pause
     -X POST
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId
         .'/pause';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

ResumeMessage

Resume sending a message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/resume

POST Parameters

name in description required type format
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/resume
     -X POST
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId
         .'/resume';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

SearchMessages

Search messages with specified terms.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/search/{term}

GET Parameters

name in description required type format
accountId path The accountId. true string uuid
term path The search terms true string
skip query The skip. false integer int32
take query The take. false integer int32

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/search/{term}?skip=10&take=10
     -X GET
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'term' => 'term'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/search/'
         .$term
         .'?skip=10&take=10';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

SendTestMessage

Sends a test message.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/test

POST Parameters

name in description required type format schema
accountId path The accountId. true string uuid
messageId path The identifier. true string uuid
recipients body The test message recipients. true
  • {
    • "contact" : "string",
    • "data" : {
      • "description" : "Gets or sets the json data for recipient.",
      • "type" : "object",
      • "additionalProperties" : "string"
      }, "group" : "string",
    • "msisdn" : "string"
    }

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/messages/{messageId}/test
     -X POST
     -H "Content-Type: application/json"
     -d "{
 'contact' : 'string',
 'data' : {
  'description' : 'Gets or sets the json data for recipient.',
  'type' : 'object',
  'additionalProperties' : 'string'
 },
 'group' : 'string',
 'msisdn' : 'string'
}"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'messageId' => 'messageId',
    'data' => json_encode(array(
               "contact" => "string",
               "data": array(
                "description" => "Gets or sets the json data for recipient.",
                "type" => "object",
                "additionalProperties" => "string"
               ),
               "group" => "string",
               "msisdn" => "string"
              )          )
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/messages/'
         .$messageId
         .'/test';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_POST           => true,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>

Senders

GetSenders

Gets senders.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders

GET Parameters

name in description required type format
accountId path The accountId. true string uuid

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders
     -X GET
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/senders';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>
AddSender

Adds a Sender.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders

POST Parameters

name in description required type format schema
accountId path The accountId. true string uuid
sender body The sender. true
  • {
    • "isFavorite" : {
      • "description" : "Gets or sets the isFavorite.",
      • "type" : "boolean"
      }, "name" : "string",
    • "senders" : {
      • "description" : "Gets or sets the senders.",
      • "type" : "object",
      • "additionalProperties" : "string"
      }
    }

Responses

http status description
201 Created

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders
     -X POST
     -H "Content-Type: application/json"
     -d "{
 'isFavorite' : {
  'description' : 'Gets or sets the isFavorite.',
  'type' : 'boolean'
 },
 'name' : 'string',
 'senders' : {
  'description' : 'Gets or sets the senders.',
  'type' : 'object',
  'additionalProperties' : 'string'
 }
}"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'data' => json_encode(array(
               "isFavorite": array(
                "description" => "Gets or sets the isFavorite.",
                "type" => "boolean"
               ),
               "name" => "string",
               "senders": array(
                "description" => "Gets or sets the senders.",
                "type" => "object",
                "additionalProperties" => "string"
               )
              )          )
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/senders';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_POST           => true,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>
UpdateSender

Updates a Sender.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders/{senderId}

PUT Parameters

name in description required type format schema
accountId path The accountId. true string uuid
senderId path The identifier. true string uuid
senderPreset body The sender. true
  • {
    • "isFavorite" : {
      • "description" : "Gets or sets the isFavorite.",
      • "type" : "boolean"
      }, "name" : "string",
    • "senders" : {
      • "description" : "Gets or sets the senders.",
      • "type" : "object",
      • "additionalProperties" : "string"
      }
    }

Responses

http status description
200 OK

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders/{senderId}
     -X PUT
     -H "Content-Type: application/json"
     -d "{
 'isFavorite' : {
  'description' : 'Gets or sets the isFavorite.',
  'type' : 'boolean'
 },
 'name' : 'string',
 'senders' : {
  'description' : 'Gets or sets the senders.',
  'type' : 'object',
  'additionalProperties' : 'string'
 }
}"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'senderId' => 'senderId',
    'data' => json_encode(array(
               "isFavorite": array(
                "description" => "Gets or sets the isFavorite.",
                "type" => "boolean"
               ),
               "name" => "string",
               "senders": array(
                "description" => "Gets or sets the senders.",
                "type" => "object",
                "additionalProperties" => "string"
               )
              )          )
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/senders/'
         .$senderId;

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_CUSTOMREQUEST  => 'PUT',
     CURLOPT_POST           => true,
     CURLOPT_POSTFIELDS     => $data,
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>
DeleteSender

Deletes a Sender.

https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders/{senderId}

DELETE Parameters

name in description required type format
accountId path The accountId. true string uuid
senderId path The identifier. true string uuid

Responses

http status description
204 NoContent

Code Examples:

cURL
curl -i https://api.cmtelecom.com/messages/v1/accounts/{accountId}/senders/{senderId}
     -X DELETE
     -H "Content-Type: application/json"
PHP
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'accountId' => 'accountId',
    'senderId' => 'senderId'
  );

  $url = 'https://api.cmtelecom.com/messages/v1/accounts/'
         .$accountId
         .'/senders/'
         .$senderId;

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json'
                                 ),
     CURLOPT_HEADER       => TRUE,
     CURLOPT_CUSTOMREQUEST  => 'DELETE',
     CURLOPT_RETURNTRANSFER => true
    )
  );
  $result = curl_exec($ch);
  $HeaderInfo = curl_getinfo($ch);
  $HeaderSize=$HeaderInfo['header_size'];
  $Body = trim(mb_substr($result, $HeaderSize));
  $ResponseHeader = explode('\n',trim(mb_substr($result, 0, $HeaderSize)));
  unset($ResponseHeader[0]);
  $Headers = array();
  foreach($ResponseHeader as $line){
      list($key,$val) = explode(':',$line,2);
      $Headers[strtolower($key)] = trim($val);
  }

  var_dump( array(
      'Body' => $Body,
      'Headers' => $Headers
  ));
?>