Jan 16, 2009

Easy SMS integration for your application

Vodacom Developer Zone has an awesome product suite to integrate SMS capability into your applications. And its so easy to use, and thats what I'm all about ;)

Using their common gateway you can send SMSs via:

  • HTTP/S
  • XML
  • COM Object
  • FTP
  • SMPP
  • SMTP

I needed to write a C# app exposing the COM Object to send our patients reminders about appointments, seeing as though our current RIS is archaic and does not integrate SMSs. This quickly grew to three-application suite including a version to send account payment advices, with my Comms Edition facilitating easy internal staff communications through a group manager. See image below (Click to enlarge):

sms 

The SMS classes support a wide variety of features including batch sending and delivery reports. SMS credits are purchased through Clickatell for about US$0.03 per SMS (33 South African cents), with discounts applicable on larger bundle purchases.

And the code? Easy of course!

1. Declare the SMS object:

SMS_COMAPILib.SMS oSMS = new SMS_COMAPILib.SMS();

2. Send the SMS:


string msgID = oSMS.SendMsg(true, smsNow, cellNow); 

The boolean states whether to use your session id, smsNow is the message and cellNow is the mobile number. The method returns a MessageID handy to generate a delivery report.

3. Get delivery report:


string queryResult = oSMS.QueryMsg(msgID, SMS_COMAPILib.eSMSAPIorCLI_ID.SMS_API_ID); 

No comments: