SMS Gateway in Kentico CMS

   —   
Have you ever dreamt of sending SMS messages directly from Kentico CMS? If your answer is YES, you should definitely read this post.

Following SMS gateway integration is based on Clickatell - the largest online SMS gateway covering 819 networks in 221 countries and territories. There are several ways how you can connect to Clickatell and send SMS messages, we have chosen the most popular way - HTTPS conection. Our goal was to deliver you the base Clickatell API integration which enables you to send SMS messages, that's what we made. However Clickatell gateway also supports some advanced features such as sending bulk SMS messages, receiving message delivery status, pushing MMS messages etc.


Pricing
I am sure the price for a single SMS message is what you are interested in. Unfortunately, SMS messages are NOT FREE! See Clickatell message pricing for more details. Anyway, I think it's worth it. Their service seems to be really on a high level. We also found no problems while we were testing it. SMS messages were delivered immediately as if they had been sent from the cell phone.


Now let's have a look at the SMS gateway integration package, it includes:

1) SMS gateway
Following two classes represent the base API for sending SMS messages.

SMSMessage.cs - Simple data container representing SMS message.

Properties
string From -  Phone number the SMS message should be sent from. If not set, phone number from settings is used.
string To -  Phone number the SMS message should be sent to. It must be entered in international format.
string Text - Message text.

SMSProvider.cs - Simple SMS provider which enables you to send SMS messages.

Properties
string ApiID - API ID of your Clickatell account. If not se, API ID from settings is used.
string Login - Login of your Clickatell account. If not set, login from settings is used.
string Password - Password of your Clickatell account. If not set, password from settings is used.

Methods
SendSMS(SMSMessage message) - Ensures Clickatell account authentication (if not already authenticated) and sends specified SMS message

API example:
smsAPI.png



2) SMS notification gateway
Following class represents notification gateway for sending SMS messages to content changes.

SMSNotificationGateway.cs - custom nofitification gateway, integration is built on the customization model described here. It uses SMSMessage and SMSProvider classes mentioned above.

smsnotification.png smsnotification2.png



3) SMS sender web part 
Simple web part which demonstrates how easy is to initialize and send SMS message.

smsWebPart.png



4) SMS gateway settings 
SMS Login - Login of your Clickatell account.
SMS Password - Password of your Clickatell account.
SMS API ID - API ID of your Clickatell account.
SMS From - Phone number the SMS messages are sent from.

smssettings.png


 

Installation instructions 
  1.  Download SMS gateway integration package
  2. Backup your original project so you can restore it in case something goes wrong.
  3. Move export_sms.zip file into <your web project folder>/CMSSiteUtils/Import folder
  4. Go to CMS Site Manager -> Sites and click Import site or objects link.
  5. Choose export_sms.zip file and import it:
  • SMS notification gateway will be registered in CMS Site Manager › Development › Notifications section.
  • New SMS Sender web part will be created in SMS web part category.
  • New settings will be created in SMS gateway category in Site Manager › Settings.
  1. Copy content of CMS folder into your web project folder:
  • \CMSModules\Notifications\Controls\NotificationSubscription\SMSNotificationSubscription.ascx
  • \CMSModules\Notifications\Controls\NotificationSubscription\SMSNotificationSubscription.ascx.cs
  • \Bin\[ ALL DLLs from 5.5 version ]
  1. Create your account at Clickatell.com. You will receive several free SMS credits to test the service for free.
  2. Get your API ID.

 

 

  1. Go to CMS Site Manager -> Settings and setup information about your Clicatell account
  2. Now you are ready to send SMS messages (you can try SMS Sender web part as simple usage example).
Follow these instructions if you plan to make some changes to SMS gateway code:
  1. Open your web project in Visual Studio and click File -> Add -> Existing project. Locate SMS gateway project folder which is included in the installation package and choose its project file. SMS gateway project will be added to your solution.
  2. Remove all the references to the Kentico CMS libraries from the SMS gateway project and replace them with references to the corresponding DLLs from <your web project folder>/Bin folder.
  3. Right click Bin folder in your web project folder, choose Add Reference option, click the Projects tab and choose SMS gateway project.
  4. Make your changes to SMS gateway and compile the solution.

I hope that some of you will find it useful ;)
 
Share this article on   LinkedIn Google+

Petr Vozak

Technology Partnership Product Owner at Kentico. He works with technology partners to enrich the Kentico product offering and bring greater value to those using our products.

Comments

JAA commented on

Im getting an error importing to a vanilla Kentico7. Is this still compatible?

Error during temporary files creation. Original exception: [ImportProvider.CreateTemporaryFiles]: Data not found or the package is not a valid export package. (C:\inetpub\wwwroot\baseKenticoCMS7\KenticoCMS7\App_Data\CMSTemp\ImportExport\Data)

Thanks

petr.vozak-kentico commented on

@Leslie: Basically, there is no change in Notifications module in V6 and also the Clickatell should be fine (www.clickatell.com/apis-scripts/scripts/c-scripts/). From Kentico point of view all you need to do is to reflect the API changes made in V6 - devnet.kentico.com/Blogs/Martin-Hejtmanek/November-2011/Changes-in-the-API-from-version-Kentico-CMS-5-5-R2.aspx. The rest - the steps and idea is still the same.

Leslie witham commented on

Hi Petr, How can i make this work with Kentico 6.0? Any help would be greatly appreciated.

mellisa @ bank details commented on

thanks :)

petr.vozak-kentico commented on

Hi Fabricio. First, I changed your comment and replaced your logon information from the URL to avoid others logging under your account :) Anyway, I have logged on under your account and found out that you had used Client ID instead of API ID. You can find new screenshot in my blog post describing the page where the API ID is located.

Fabricio Baldi commented on

Hi, please I need you help

why appear this error?
ERR: 108, Invalid or missing api_id


http://api.clickatell.com/http/sendmsg?user=YYY&password=YYY&api_id=ZZZ&to=5434444498711&text=Meet+me+at+home

the api_id is correct...

thanks a lot