Difference between pages "SMS Notify!" and "SMSv2 PHP"

From CDYNE Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Bdriggers
(SMS Notify! SMS Methods)
 
imported>Wcchenoweth
 
Line 1: Line 1:
Send text messages worldwide from your website or application through CDYNE's SMS Gateway. SMS Notify! uses [http://wiki.cdyne.com/index.php/Glossary#DID DID]s or [http://wiki.cdyne.com/index.php/Glossary#Short_Code short codes] assigned to your account license key to send [http://wiki.cdyne.com/index.php/Glossary#MT_.28Mobile_Terminated.29 MT] text messages and receive [http://wiki.cdyne.com/index.php/Glossary#MO_.28Mobile_Originated.29 MO] text messages. Use a Web Services client in any programming language to interact with SMS Notify! API.
+
The following example was built using PHP 5.3.2. Your setup may differ, so please assure that your PHP 5.x version supports the SOAPClient class.
  
* Your server or application makes a CDYNE SMS Notify! API Request
+
==== SimpleSMSSend ====
* CDYNE replies with an API response
+
*Send a single message to a single number.
* CDYNE sends message to appropriate aggregator
+
<php>
* Aggregator delivers message to appropriate carrier
 
* Carrier acknowledges receipt of message (''short codes only'')
 
* Carrier delivers message to cell phone
 
  
 +
// Create a new soap client based on the SMS Notify! WCF service
 +
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');
  
== Supports SMS ==
+
// Specify required info to send a text message
 +
$param = array(
 +
'PhoneNumber' => '7891234567',
 +
'LicenseKey' => '(your license key here)',
 +
'Message' => 'test'
 +
);
  
==== [[SimpleSMSSend]] ====
+
// Send the text message
Send single, immediate text messages from your website or application.
+
$result = $client->SimpleSMSsend($param);
  
==== [[SimpleSMSSendWithPostback]] ====
+
// View the response from CDYNE
Send single, immediate text messages from your website or application utilizing the [http://wiki.cdyne.com/index.php/SMS_Notify!_PostBackURLs PostBackURL] feature.
+
print_r($result);
  
==== [[AdvancedSMSSend]] ====
+
</php>
Immediately send or schedule a single text message to multiple phone numbers, or individual messages to multiple recipients. The AdvancedSMSSend method includes a [http://wiki.cdyne.com/index.php/SMS_Notify!_PostBackURLs PostBackURL] parameter.
 
  
==== [[GetMessageStatus]] ====
+
==== AdvancedSMSSend ====
The GetMessageStatus method uses the MessageID parameter to return the status of a message.
+
*Send different messages to different numbers with one method.
  
==== [[GetMessageStatusByReferenceID]] ====
+
<php>
This method returns all messages with a predefined user ReferenceID set in [[AdvancedSMSSend]] method.
 
  
==== [[GetUnreadIncomingMessages]] ====
+
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');
This method returns all unread text message responses attached to a single License Key and marks them as read.
 
  
==== [[ CancelMessage ]] ====
+
$lk = '(your license key here)';
CancelMessage uses the Message ID to cancel a message scheduled for a later time or date.  Does not work if message was already sent out or queued.
 
  
==== [[ GetKeywords ]] ====
+
$PhoneNumbersArray1 = array('0123456789', '4567891230');
Gets all currently enabled keywords for a license key.
+
$PhoneNumbersArray2 = array('1234567890', '7652212120');
  
==== [[ AssignKeyword ]] ====
+
$Message1 = 'Hello World';
Assigns one or more keywords to a license key.
+
$Message2 = 'Goodbye World';
  
==== [[ RemoveKeyword ]] ====
 
Removes one or more assigned keywords from a license key.
 
  
== SMS Notify! SMS Documentation Links ==
+
$RequestArray = array(
 +
array(
 +
'AssignedDID'=>'',
 +
                                      //If you have a Dedicated Line, you would assign it here.
 +
'Message'=>$Message1, 
 +
'PhoneNumbers'=>$PhoneNumbersArray1,
 +
'ReferenceID'=>'',
 +
                                      //User defined reference, set a reference and use it with other SMS functions.
 +
//'ScheduledDateTime'=>'2010-05-06T16:06:00Z',
 +
                                      //This must be a UTC time.  Only Necessary if you want the message to send at a later time.
 +
'StatusPostBackURL'=>''
 +
                                      //Your Post Back URL for responses.
 +
)
 +
,array(
 +
'AssignedDID'=>'',
 +
'Message'=>$Message2,
 +
'PhoneNumbers'=>$PhoneNumbersArray2,
 +
'ReferenceID'=>'',
 +
'ScheduledDateTime'=>'2010-05-06T16:06:00Z',
 +
'StatusPostBackURL'=>''
 +
)
 +
);
  
'''[https://secure.cdyne.com/downloads/SPECS_SMS-Notify2.pdf SMS Notify! Specification Sheet]''' <br>
+
$request = new AdvancedCallRequestData($lk,$RequestArray);
 +
//print_r($request);
  
PDF document containing all SMS Notify! programming methods with request and response descriptions.
+
$result = $client->AdvancedSMSsend($request);
 +
print_r($result);
  
'''[http://sms2.cdyne.com/sms.svc?wsdl WSDL]''' <br>
+
class AdvancedCallRequestData {
 +
  public $AdvancedRequest;
  
An XML format document that defines SMS Notify! endpoints.
+
  function AdvancedCallRequestData($licensekey,$requests) {
 +
            $this->AdvancedRequest = array();
 +
            $this->AdvancedRequest['LicenseKey'] = $licensekey;
 +
            $this->AdvancedRequest['SMSRequests'] = $requests;
 +
  }
 +
}
  
'''[http://sms2.cdyne.com/sms.svc/help HTTP Service Operations]''' <br>  
+
</php>
  
Service operations at endpoint http://sms2.cdyne.com/sms.svc
+
==== GetMessageStatusByReferenceID ====
 +
*Returns all Messages with a predefined user ReferenceID set in AdvancedSMSSend.
  
'''[https://sms2.cdyne.com/sms.svc/SecureREST/help HTTPS Service Operations]''' <br>
+
<php>
  
Service operations at https://sms2.cdyne.com/sms.svc/SecureREST
+
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');
  
'''[http://www.cdyne.com/downloads/international-sms-coverage.xls International Extended Suppported Carriers]''' <br>  
+
$param = array(
 +
'ReferenceID' => '(your reference ID, set in AdvancedSMSSend)'
 +
,'LicenseKey' => '(your license key)'
 +
);
  
Excel doc containing carriers supported worldwide. Includes destination pricing, available DIDs, carrier restrictions, and reach.
+
$result = $client->GetMessageStatusByReferenceID($param);
  
== API Features ==
+
print_r($result);
  
==== Text Message Length ====
+
</php>
  
Within your AdvancedSMSSend request if you set:
+
==== GetUnreadIncomingMessages ====
 +
*Returns all unread SMSResponses attached to a single License Key and marks them as read.
 +
<php>
  
IsUnicode = True & Concatenate = True, the max message length is 67 characters (including spaces)
+
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');
Concatenate = True, the max message length is 153 characters (including spaces)
 
IsUnicode = True, the max message length is 70.0 characters (including spaces)
 
  
However, if you set both the IsUnicode and Concatenate parameters to false within your request, the maximum character limit is 160 (including spaces).
+
$param = array(
 +
'LicenseKey' => '(your license key)'
 +
);
  
 +
$result = $client->GetUnreadIncomingMessages($param);
  
 +
print_r($result);
  
===== U.S. SMS =====
+
</php>
 +
==== GetMessageStatus ====
 +
*Returns the status of a single SMS message using the Message ID from the SMSResponse object.
 +
<php>
  
U.S. Carriers are standardized and all text messages are 160 characters (including spaces) in length. When sending a text message to a recipient in the U.S. with more than 160 characters, the SMS Notify! API will automatically split the message into two or more messages for delivery.
+
$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');
  
===== Canadian SMS =====
+
$param = array(
 +
'MessageID' => '(your message ID here)'//MessageID from SMSResponse Object
 +
);
  
Canadian Carriers vary from 136 to 160 characters (including spaces) in length. CDYNE sends to Canada the same way as the U.S. To ensure complete message delivery, CDYNE advises that your application only send messages to Canadian recipients in 136 character increments. If the message is longer than 136 characters, the best practice is to split the message on your application side at the 136 character mark to avoid data loss that may occur from Canadian Carriers that truncate anything over 136 or 140 characters.
+
$result = $client->GetMessageStatus($param);
  
==== [http://wiki.cdyne.com/index.php/SMS_Notify!_PostBackURLs PostBackURL] ====
+
print_r($result);
Know when your MT message has been sent or your application has received a MO or response message. CDYNE SMS Notify! API will automatically post information to a URL you specify each time an SMS has been sent or received.
 
  
==== [[DID System Keywords]] ====
+
</php>
SMS Notify! API will automatically respond to select keywords when receiving text messages with DIDs.
 
 
 
==== [[Short Code System Keywords]] ====
 
SMS Notify! API will automatically respond to select keywords when receiving text messages with short codes.
 
 
 
==== [[Short Code Incoming Keyword Management]] ====
 
Managing keywords assigned to short codes.
 
 
 
==== [[Unicode Support]] ====
 
SMS Notify! supports Unicode with International Extended DIDs.
 
 
 
==== [[Message Concatenation]] ====
 
SMS Notify! supports message concatenation.
 
 
 
==== [[SMS Error Returns]] ====
 
SMS Notify! API contains a parameter called SMSError, which returns a string indicating errors when sending the text message.
 
 
 
==== [[SMS and Invalid Phone Numbers]] ====
 
How SMS Notify! handles invalid phone numbers.
 
 
 
==== IP Ranges ====
 
 
 
4.59.146.64-128 and 4.26.64.64-128
 
 
 
== SMS Notify! Best Practices ==
 
 
 
'''[[DID Best Practices]]''' <br>
 
Best practices for using [[SimpleSMSSend]] and [[AdvancedSMSSend]] with DIDs. Includes PostBack data, volume considerations and carrier coverage.  <br><br>
 
 
 
'''[[Short Code Best Practices]]''' <br>
 
Best practices for using [[SimpleSMSSend]] and [[AdvancedSMSSend]] with short codes. Includes PostBack data, volume considerations and carrier coverage.
 

Revision as of 15:12, 13 October 2010

The following example was built using PHP 5.3.2. Your setup may differ, so please assure that your PHP 5.x version supports the SOAPClient class.

SimpleSMSSend

  • Send a single message to a single number.

<php>

// Create a new soap client based on the SMS Notify! WCF service $client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');

// Specify required info to send a text message $param = array( 'PhoneNumber' => '7891234567', 'LicenseKey' => '(your license key here)', 'Message' => 'test' );

// Send the text message $result = $client->SimpleSMSsend($param);

// View the response from CDYNE print_r($result);

</php>

AdvancedSMSSend

  • Send different messages to different numbers with one method.

<php>

$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');

$lk = '(your license key here)';

$PhoneNumbersArray1 = array('0123456789', '4567891230'); $PhoneNumbersArray2 = array('1234567890', '7652212120');

$Message1 = 'Hello World'; $Message2 = 'Goodbye World';


$RequestArray = array( array( 'AssignedDID'=>,

                                     //If you have a Dedicated Line, you would assign it here.

'Message'=>$Message1, 'PhoneNumbers'=>$PhoneNumbersArray1, 'ReferenceID'=>,

                                     //User defined reference, set a reference and use it with other SMS functions.

//'ScheduledDateTime'=>'2010-05-06T16:06:00Z',

                                     //This must be a UTC time.  Only Necessary if you want the message to send at a later time.

'StatusPostBackURL'=>

                                     //Your Post Back URL for responses.

) ,array( 'AssignedDID'=>, 'Message'=>$Message2, 'PhoneNumbers'=>$PhoneNumbersArray2, 'ReferenceID'=>, 'ScheduledDateTime'=>'2010-05-06T16:06:00Z', 'StatusPostBackURL'=> ) );

$request = new AdvancedCallRequestData($lk,$RequestArray); //print_r($request);

$result = $client->AdvancedSMSsend($request); print_r($result);

class AdvancedCallRequestData {

 public $AdvancedRequest;
 function AdvancedCallRequestData($licensekey,$requests) { 
           $this->AdvancedRequest = array();
           $this->AdvancedRequest['LicenseKey'] = $licensekey;
           $this->AdvancedRequest['SMSRequests'] = $requests;
 }

}

</php>

GetMessageStatusByReferenceID

  • Returns all Messages with a predefined user ReferenceID set in AdvancedSMSSend.

<php>

$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');

$param = array( 'ReferenceID' => '(your reference ID, set in AdvancedSMSSend)' ,'LicenseKey' => '(your license key)' );

$result = $client->GetMessageStatusByReferenceID($param);

print_r($result);

</php>

GetUnreadIncomingMessages

  • Returns all unread SMSResponses attached to a single License Key and marks them as read.

<php>

$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');

$param = array( 'LicenseKey' => '(your license key)' );

$result = $client->GetUnreadIncomingMessages($param);

print_r($result);

</php>

GetMessageStatus

  • Returns the status of a single SMS message using the Message ID from the SMSResponse object.

<php>

$client = new SoapClient('http://sms2.cdyne.com/sms.svc?wsdl');

$param = array( 'MessageID' => '(your message ID here)'//MessageID from SMSResponse Object );

$result = $client->GetMessageStatus($param);

print_r($result);

</php>