Skip to content
PHP SDK to send messages with
Branch: master
Clone or download
hexonthebeach Multibyte support improvement (#11)
* Added PHP7.3 to travis yml

* Added local gateways for China and United Kingdom

* Improved multibyte character support

* Updated version to 1.1.3
Latest commit 46bda5f Oct 11, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/CMText Multibyte support improvement (#11) Oct 11, 2019
tests Develop (#5) Apr 5, 2019
.gitignore initial commit Nov 27, 2018
.travis.yml Multibyte support improvement (#11) Oct 11, 2019
LICENSE Update date in license to 2019 Feb 26, 2019 Develop (#5) Apr 5, 2019
composer.json Multibyte support improvement (#11) Oct 11, 2019

Build Status codecov


A software development kit to provide ways to interact with's Text service. API used:


  • php 7.*


Instantiate the client

Using your unique ApiKey (or product token) which authorizes you on the CM platform. Always keep this key secret!

$client = new TextClient('your-api-key');

Send a message

By calling SendMessage and providing message text, sender name, recipient phone number(s) and a reference (optional).

$result = $client->SendMessage('Message_Text', '', [ 'Recipient_PhoneNumber' ], 'Your_Reference');

Get the result

SendMessage and send return an object of type TextClientResult, example:

  "statusMessage": "Created 1 message(s)",
  "statusCode": 201,
  "details": [
      "reference": "Example_Reference",
      "status": "Accepted",
      "to": "Example_PhoneNumber",
      "parts": 1,
      "details": null
      "reference": "Example_Reference2",
      "status": "Rejected",
      "to": "Example_PhoneNumber2",
      "parts": 0,
      "details": "A body without content was found"

Sending a rich message

By using the Message class it is possible to create messages with media for channels such as WhatsApp and RCS

$client = new TextClient('your-api-key');
$message = new Message('Message Text', 'Sender_name', ['Recipient_PhoneNumber']);
        new MediaMessage(
        new ReplySuggestion('Opt In', 'OK'),
        new ReplySuggestion('Opt Out', 'STOP'),
$result = $client->send( [$message] );

Status codes

For all possibly returned status codes, please reference the TextClientStatusCodes class.

You can’t perform that action at this time.