Send
Send
PHP

Introduction

The Send Api provides an easy way to send messages and campaigns. This API is used for SMS Campaigns and Send

Channels

getChannels

Find all channels

https://api.cmtelecom.com/send/v2.0/channels

GET Parameters

name in description required type
accountGuid query Account GUID true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation

<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/channels?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>
curl -i https://api.cmtelecom.com/send/v2.0/channels?accountGuid='accountGuid'
     -X GET
     -H "Content-Type: application/json"

getAChannel

Find a channel by value/appKey

https://api.cmtelecom.com/send/v2.0/channels/{value}

GET Parameters

name in description required type
accountGuid query Account GUID true string
value path value or app key true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation

curl -i https://api.cmtelecom.com/send/v2.0/channels/{value}?accountGuid='accountGuid'
     -X GET
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'value' => 'value',
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/channels/'
         .$value
         .'?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>

Costs

getExpectedCosts

Get expected costs

https://api.cmtelecom.com/send/v1.0/costs/expected

GET Parameters

name in description required type items
accountGuid query Account GUID true string
msisdns query MSISDN phone numbers false array
  • "string"
contacts query Contact guids false array
  • "string"
groups query Group guids false array
  • "string"
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
400 Error: 4003, This account has no price plan, probably uses credits instead

curl -i https://api.cmtelecom.com/send/v1.0/costs/expected?accountGuid='accountGuid'&msisdns='msisdns'&contacts='contacts'&groups='groups'
     -X GET
     -H "Content-Type: application/json"
     -d "'string'"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v1.0/costs/expected?accountGuid='accountGuid'&msisdns='msisdns'&contacts='contacts'&groups='groups'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>

getRealisedCosts

Get realised costs

https://api.cmtelecom.com/send/v1.0/costs/realised

GET Parameters

name in description required type
accountGuid query Account GUID true string
messageId query Message id false string
messageGuid query Message guid false string
startDate query Start date (requires: endDate) false string
endDate query End date (requires: startDate false string
reference query Reference (requires: startDate and endDate) false string
customGrouping1 query Custom grouping 1 (requires: startDate and endDate) false string
customGrouping2 query Custom grouping 2 (requires: startDate and endDate) false string
customGrouping3 query Custom grouping 3 (requires: startDate and endDate) false string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
400 Error: 4004, Failed to calculate costs

curl -i https://api.cmtelecom.com/send/v1.0/costs/realised?accountGuid='accountGuid'&messageId='messageId'&messageGuid='messageGuid'&startDate='startDate'&endDate='endDate'&reference='reference'&customGrouping1='customGrouping1'&customGrouping2='customGrouping2'&customGrouping3='customGrouping3'
     -X GET
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v1.0/costs/realised?accountGuid='accountGuid'&messageId='messageId'&messageGuid='messageGuid'&startDate='startDate'&endDate='endDate'&reference='reference'&customGrouping1='customGrouping1'&customGrouping2='customGrouping2'&customGrouping3='customGrouping3'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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

sendMessage

Send a message

https://api.cmtelecom.com/send/v2.0/messages

POST Parameters (required)

Authentication

These required parameter values can be found at https://gateway.cmtelecom.com.

Name In Description Required Type
accountGuid query Account Guid true string
X-CM-SSO-PRODUCTTOKEN header API producttoken true string

Request values

Name In Description Required Type
Body body The message will contain this text true string
From body The sender true object
From.Type body Sender type true string
From.Name body Sender name true string
From.Value body Sender value true string
To body Recipients array true array
To[object] body A recipient true object
To[object.Type] body Recipient type true string
To[object.Name] body Recipient name true string
To[object.Value] body Recipient value true string
Channel body The channel the message is sent through true object
Channel.Type body SMS or Push true string
Channel.Name body The message will be containing this text true string
Channel.Value body The message will be containing this text true string
SendAt body Send message at: timestamp (UTC) / "now" / null (save campaign as draft) true string

Basic SMS message body

Although SMS is the default "channel", we support sending through alternate (if configured) channels like push.
Use "getChannels" for supported channels.

{
    "Body": "This is a test message",
    "From": 
    {
        "Type": "alphanumeric",
        "Name": "Test",
        "Value": "Test"
    },
    "To":
    [
        {
            "Type": "msisdn|group|contact",
            "Name": "+31 6 27142592|Group Name|Contactname",
            "Value": "0031627142592|87067157-09e6-4a8e-b2da-06bfc126a8cd|be5cc93b-e441-4465-9a20-42ed5ceb3f8d"
        }
    ],
    "Channel":
    [
        {
            "Type": "sms",
            "Name": "SMS",
            "Value": "sms"
        }
    ],
    "SendAt" : "2018-11-01T18:00:00+00:00"
}

Campaign message body

Name In Description Required Type
Campaign body Set to reference a campaign true object
Campaign.Name body Campaign name true string
Campaign.ConversionLink body Will be converted to a shorturl and replace {{link}} merge tag false string
{
    "Body": "This is a test campaing with a link {{link}}",
    "From": 
    {
        "Type": "alphanumeric",
        "Name": "Test",
        "Value": "Test"
    },
    "To":
    [
        {
            "Type": "msisdn|group|contact",
            "Name": "+31 6 27142592|Group Name|Contactname",
            "Value": "0031627142592|87067157-09e6-4a8e-b2da-06bfc126a8cd|be5cc93b-e441-4465-9a20-42ed5ceb3f8d"
        }
    ],
    "Channel":
    [
        {
            "Type": "sms",
            "Name": "SMS",
            "Value": "sms"
        }
    ],
    "Campaign": 
    {
        "Name": "Campaign 1",
        "ConversionLink": "https://www.campaign1.org/"
    },
    "SendAt" : "now"
}

Response

HTTP status Description
201 successful operation
400 Invalid request

Basic SMS response body

{
  "Guid": "111233d4-2c81-4053-97ba-c0e15b98e8d7",
  "AccountGuid": "7de5b4ee-7660-4450-a233-2d1eb9e2a8e3",
  "Template": null,
  "Campaign": null,
  "LandingPage": null,
  "Status": "scheduled",
  "From": {
    "Type": "alphanumeric",
    "Name": "Test",
    "Value": "Test",
    "CountryCode": null,
    "AllowReply": false
  },
  "To": [
    {
      "Type": "msisdn",
      "Name": "A name",
      "Value": "0031612345678",
      "CountryCode": null
    }
  ],
  "Body": "This is a test message",
  "Channel": [
    {
      "Type": "sms",
      "Name": "SMS",
      "Value": "sms"
    }
  ],
  "CustomGrouping1": null,
  "CustomGrouping2": "app:send",
  "CustomGrouping3": null,
  "SendWindow": null,
  "SendAt": "2018-08-01T09:21:00+00:00",
  "QueuedAt": null,
  "ProcessedAt": null,
  "FailedAt": null,
  "Report": null,
  "CreatedAt": "2018-08-01T08:20:42+00:00",
  "UpdatedAt": "2018-08-01T08:20:42+00:00"
}

Campaign response body

{
  "Guid": "33204daa-9d05-468a-8d11-e0768e3adbb6",
  "AccountGuid": "7de5b4ee-7660-4450-a233-2d1eb9e2a8e3",
  "Template": null,
  "Campaign": {
    "Name": "Campaign Test",
    "ConversionLink": "https://www.campaign1.org/"
  },
  "LandingPage": null,
  "Status": "scheduled",
  "From": {
    "Type": "alphanumeric",
    "Name": "Test",
    "Value": "Test",
    "CountryCode": null,
    "AllowReply": false
  },
  "To": [
    {
      "Type": "group",
      "Name": "A contact",
      "Value": "f71e95b5-313b-4140-b5c3-1cd4513251ae",
      "CountryCode": null
    }
  ],
  "Body": "This is a test campaing with a link {{link}}",
  "Channel": [
    {
      "Type": "sms",
      "Name": "SMS",
      "Value": "sms"
    }
  ],
  "CustomGrouping1": "33204daa-9d05-468a-8d11-e0768e3adbb6",
  "CustomGrouping2": "app:sms_campaigns",
  "CustomGrouping3": null,
  "SendWindow": null,
  "SendAt": "2018-08-01T09:20:00+00:00",
  "QueuedAt": null,
  "ProcessedAt": null,
  "FailedAt": null,
  "Report": null,
  "CreatedAt": "2018-08-01T08:19:34+00:00",
  "UpdatedAt": "2018-08-01T08:19:34+00:00"
}
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'data' => json_encode(array(
               "Guid" => "integer",
               "AccountGuid" => "string",
               "Template": array(
                "Name" => "string"
               ),
               "Campaign": array(
                "Name" => "string",
                "ConversionLink" => "string",
                "CreatedAt" => "string",
                "UpdatedAt" => "string"
               ),
               "LandingPage": array(
                "TemplateGuid" => "string",
                "CampaignGuid" => "string",
                "Mappings": array(
                 "example" => ""
                )
               ),
               "Status" => "string",
               "Name" => "string",
               "From": array(
                "Type": array(
                 "example" => ""
                ),
                "Name" => "string",
                "Value" => "string",
                "CountryCode" => "string",
                "AllowReply": array(
                 "type" => "boolean",
                 "example" => ""
                )
               ),
               "To": array(
                "Type": array(
                 "example" => ""
                ),
                "Name" => "string",
                "Value" => "string",
                "CountryCode" => "string",
                "RecipientCount" => "integer",
                "IsTestRecipient": array(
                 "type" => "boolean",
                 "example" => ""
                )
               ),
               "Body" => "string",
               "Channel": array(
                "Type": array(
                 "example" => ""
                ),
                "Name" => "string",
                "Value" => "string"
               ),
               "CustomGrouping1" => "string",
               "CustomGrouping2" => "string",
               "CustomGrouping3" => "string",
               "SendWindow" => "string",
               "SendAt" => "string",
               "QueuedAt" => "string",
               "ProcessedAt" => "string",
               "FailedAt" => "string",
               "Report": array(
                "RecipientCount" => "integer",
                "SentCount" => "integer",
                "FailedCount" => "integer"
               ),
               "ProductToken" => "string",
               "CreatedAt" => "string",
               "UpdatedAt" => "string"
              )          ),
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/message';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>
curl -i https://api.cmtelecom.com/send/v2.0/message
     -X POST
     -H "Content-Type: application/json"
     -d "{
    "Body": "This is a test message",
    "From": 
    {
        "Type": "alphanumeric",
        "Name": "Test",
        "Value": "Test"
    },
    "To":
    [
        {
            "Type": "msisdn|group|contact",
            "Name": "+31 6 27142592|Group Name|Contactname",
            "Value": "0031627142592|87067157-09e6-4a8e-b2da-06bfc126a8cd|be5cc93b-e441-4465-9a20-42ed5ceb3f8d"
        }
    ],
    "Channel":
    [
        {
            "Type": "sms",
            "Name": "SMS",
            "Value": "sms"
        }
    ],
    "SendAt" : "2018-11-01T18:00:00+00:00"
}"
getMessages

Find all messages

https://api.cmtelecom.com/send/v2.0/messages

GET Parameters

name in description required type items default enum
accountGuid query Account GUID true string
type query Filter by message type false array
  • "string"
search query Search on sender, recipient and message body false string
status query Filter result on status false array
  • "string"
test path Show only test messages false boolean
orderBy query Field that will be used to order the collection on false string send_at
  • [
    • "send_at",
    • "processed_at",
    • "created_at",
    • "updated_at"
    ]
order query The sorting method. Should be 'DESC' or 'ASC' false string desc
  • [
    • "desc",
    • "asc"
    ]
skip query Skip the first amount of messages false integer
take query Take an amount of messages false integer
recipientCount path count recipients false boolean
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
curl -i https://api.cmtelecom.com/send/v2.0/messages?accountGuid='accountGuid'&type='type'&search='search'&status='status'&orderBy='orderBy'&order='order'&skip=10&take=10
     -X GET
     -H "Content-Type: application/json"
     -d "[
 'desc',
 'asc'
]"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'test' => 'test',
    'recipientCount' => 'recipientCount',
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/messages?accountGuid='accountGuid'&type='type'&search='search'&status='status'&orderBy='orderBy'&order='order'&skip=10&take=10';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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

Find a message by guid

https://api.cmtelecom.com/send/v2.0/messages/{messageGuid}

GET Parameters

name in description required type
accountGuid query Account GUID true string
messageGuid path message guid true string
recipientCount path count recipients false boolean
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
curl -i https://api.cmtelecom.com/send/v2.0/messages/{messageGuid}?accountGuid='accountGuid'
     -X GET
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'messageGuid' => 'messageGuid',
    'recipientCount' => 'recipientCount',
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/messages/'
         .$messageGuid
         .'?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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

Update a message

https://api.cmtelecom.com/send/v2.0/messages/{messageGuid}

PUT Parameters

name in description required schema type
body body Message object that you wish to create true
  • {
    • "Guid" : "integer",
    • "AccountGuid" : "string",
    • "Template" : {
      • "Name" : "string"
      }, "Campaign" : {
      • "Name" : "string",
      • "ConversionLink" : "string",
      • "CreatedAt" : "string",
      • "UpdatedAt" : "string"
      }, "LandingPage" : {
      • "TemplateGuid" : "string",
      • "CampaignGuid" : "string",
      • "Mappings" : {
        • "example" : ""
        }
      }, "Status" : "string",
    • "Name" : "string",
    • "From" : {
      • "Type" : {
        • "example" : ""
        }, "Name" : "string",
      • "Value" : "string",
      • "CountryCode" : "string",
      • "AllowReply" : {
        • "type" : "boolean",
        • "example" : ""
        }
      }, "To" : {
      • "Type" : {
        • "example" : ""
        }, "Name" : "string",
      • "Value" : "string",
      • "CountryCode" : "string",
      • "RecipientCount" : "integer",
      • "IsTestRecipient" : {
        • "type" : "boolean",
        • "example" : ""
        }
      }, "Body" : "string",
    • "Channel" : {
      • "Type" : {
        • "example" : ""
        }, "Name" : "string",
      • "Value" : "string"
      }, "CustomGrouping1" : "string",
    • "CustomGrouping2" : "string",
    • "CustomGrouping3" : "string",
    • "SendWindow" : "string",
    • "SendAt" : "string",
    • "QueuedAt" : "string",
    • "ProcessedAt" : "string",
    • "FailedAt" : "string",
    • "Report" : {
      • "RecipientCount" : "integer",
      • "SentCount" : "integer",
      • "FailedCount" : "integer"
      }, "ProductToken" : "string",
    • "CreatedAt" : "string",
    • "UpdatedAt" : "string"
    }
accountGuid query Account GUID true string
messageGuid path message guid true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful deleted
curl -i https://api.cmtelecom.com/send/v2.0/messages/{messageGuid}?accountGuid='accountGuid'
     -X PUT
     -H "Content-Type: application/json"
     -d "{
 'Guid' : 'integer',
 'AccountGuid' : 'string',
 'Template' : {
  'Name' : 'string'
 },
 'Campaign' : {
  'Name' : 'string',
  'ConversionLink' : 'string',
  'CreatedAt' : 'string',
  'UpdatedAt' : 'string'
 },
 'LandingPage' : {
  'TemplateGuid' : 'string',
  'CampaignGuid' : 'string',
  'Mappings' : {
   'example' : ''
  }
 },
 'Status' : 'string',
 'Name' : 'string',
 'From' : {
  'Type' : {
   'example' : ''
  },
  'Name' : 'string',
  'Value' : 'string',
  'CountryCode' : 'string',
  'AllowReply' : {
   'type' : 'boolean',
   'example' : ''
  }
 },
 'To' : {
  'Type' : {
   'example' : ''
  },
  'Name' : 'string',
  'Value' : 'string',
  'CountryCode' : 'string',
  'RecipientCount' : 'integer',
  'IsTestRecipient' : {
   'type' : 'boolean',
   'example' : ''
  }
 },
 'Body' : 'string',
 'Channel' : {
  'Type' : {
   'example' : ''
  },
  'Name' : 'string',
  'Value' : 'string'
 },
 'CustomGrouping1' : 'string',
 'CustomGrouping2' : 'string',
 'CustomGrouping3' : 'string',
 'SendWindow' : 'string',
 'SendAt' : 'string',
 'QueuedAt' : 'string',
 'ProcessedAt' : 'string',
 'FailedAt' : 'string',
 'Report' : {
  'RecipientCount' : 'integer',
  'SentCount' : 'integer',
  'FailedCount' : 'integer'
 },
 'ProductToken' : 'string',
 'CreatedAt' : 'string',
 'UpdatedAt' : 'string'
}"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'messageGuid' => 'messageGuid',
    'data' => json_encode(array(
               "Guid" => "integer",
               "AccountGuid" => "string",
               "Template": array(
                "Name" => "string"
               ),
               "Campaign": array(
                "Name" => "string",
                "ConversionLink" => "string",
                "CreatedAt" => "string",
                "UpdatedAt" => "string"
               ),
               "LandingPage": array(
                "TemplateGuid" => "string",
                "CampaignGuid" => "string",
                "Mappings": array(
                 "example" => ""
                )
               ),
               "Status" => "string",
               "Name" => "string",
               "From": array(
                "Type": array(
                 "example" => ""
                ),
                "Name" => "string",
                "Value" => "string",
                "CountryCode" => "string",
                "AllowReply": array(
                 "type" => "boolean",
                 "example" => ""
                )
               ),
               "To": array(
                "Type": array(
                 "example" => ""
                ),
                "Name" => "string",
                "Value" => "string",
                "CountryCode" => "string",
                "RecipientCount" => "integer",
                "IsTestRecipient": array(
                 "type" => "boolean",
                 "example" => ""
                )
               ),
               "Body" => "string",
               "Channel": array(
                "Type": array(
                 "example" => ""
                ),
                "Name" => "string",
                "Value" => "string"
               ),
               "CustomGrouping1" => "string",
               "CustomGrouping2" => "string",
               "CustomGrouping3" => "string",
               "SendWindow" => "string",
               "SendAt" => "string",
               "QueuedAt" => "string",
               "ProcessedAt" => "string",
               "FailedAt" => "string",
               "Report": array(
                "RecipientCount" => "integer",
                "SentCount" => "integer",
                "FailedCount" => "integer"
               ),
               "ProductToken" => "string",
               "CreatedAt" => "string",
               "UpdatedAt" => "string"
              )          ),
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/messages/'
         .$messageGuid
         .'?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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

Delete a message

https://api.cmtelecom.com/send/v2.0/messages/{messageGuid}

DELETE Parameters

name in description required type
accountGuid query Account GUID true string
messageGuid path message guid true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful deleted
curl -i https://api.cmtelecom.com/send/v2.0/messages/{messageGuid}?accountGuid='accountGuid'
     -X DELETE
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'messageGuid' => 'messageGuid',
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/messages/'
         .$messageGuid
         .'?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>

Recipients

getRecipients

Find valid recipients

https://api.cmtelecom.com/send/v2.0/recipients

GET Parameters

name in description required type items
accountGuid query Account GUID true string
value query Phone number value true array
  • "string"
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string
X-CM-AUTHENTICATIONCOOKIE header SSO Authentication Cookie false string

Responses

http status description
200 successful operation
curl -i https://api.cmtelecom.com/send/v2.0/recipients?accountGuid='accountGuid'&value='value'
     -X GET
     -H "Content-Type: application/json"
     -d "'string'"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID',
    'X-CM-AUTHENTICATIONCOOKIE' => 'X-CM-AUTHENTICATIONCOOKIE'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/recipients?accountGuid='accountGuid'&value='value'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID'],
                                 'X-CM-AUTHENTICATIONCOOKIE: '.$params['X-CM-AUTHENTICATIONCOOKIE']
                                 ),
     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
  ));
?>

Senders

getSenders

Find all senders

https://api.cmtelecom.com/send/v2.0/senders

GET Parameters

name in description required type
accountGuid query Account GUID true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
curl -i https://api.cmtelecom.com/send/v2.0/senders?accountGuid='accountGuid'
     -X GET
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/senders?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>
getASender

Find a sender by value

https://api.cmtelecom.com/send/v2.0/senders/{value}

GET Parameters

name in description required type
accountGuid query Account GUID true string
value path value true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
curl -i https://api.cmtelecom.com/send/v2.0/senders/{value}?accountGuid='accountGuid'
     -X GET
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'value' => 'value',
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/senders/'
         .$value
         .'?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>
getLastUsedSender

Find last used sender

https://api.cmtelecom.com/send/v2.0/senders/lastused

GET Parameters

name in description required type
accountGuid query Account GUID true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
curl -i https://api.cmtelecom.com/send/v2.0/senders/lastused?accountGuid='accountGuid'
     -X GET
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/senders/lastused?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>

Validate

validateAccount

Validate account details. Checks if a producttoken is present and the trust score is high enough.

https://api.cmtelecom.com/send/v2.0/validate/account

GET Parameters

name in description required type
accountGuid query Account GUID true string
X-CM-SSO-ACCOUNTGUID header SSO Account Guid true string

Responses

http status description
200 successful operation
403 Error: ERROR_4032, Not enough privileges
404 Error: ERROR_4041, Missing product token
curl -i https://api.cmtelecom.com/send/v2.0/validate/account?accountGuid='accountGuid'
     -X GET
     -H "Content-Type: application/json"
<?php
  // cURL v7.18.1+ and OpenSSL 0.9.8j+ are required
  $parameters = array(
    'X-CM-SSO-ACCOUNTGUID' => 'X-CM-SSO-ACCOUNTGUID'
  );

  $url = 'https://api.cmtelecom.com/send/v2.0/validate/account?accountGuid='accountGuid'';

  $ch = curl_init();
  curl_setopt_array($ch, array(
     CURLOPT_URL            => $url,
     CURLOPT_HTTPHEADER     => array(
                                 'Content-Type: application/json',
                                 'X-CM-SSO-ACCOUNTGUID: '.$params['X-CM-SSO-ACCOUNTGUID']
                                 ),
     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
  ));
?>