SMS Notifications with Orchard CMS and Twilio
In this post I’m going to run through a quick example of how to set up SMS notifications in Orchard CMS.
Install the SMS Messaging Module
First of all install the SMS Messaging Module from the Orchard CMS Gallery.
Sign Up for a free Twilio Account
Once the module is installed and enabled, go to Twilio and sign up for a free account.
When you sign up, Twilio will give you some credit so you can try out the service; with this credit purchase a number. This number will be used to send the SMS’s and will appear when the end user receives the message.
Configure the Settings
Go into the SMS Settings area and enter the information found in Twilio. You’ll need the following information:
- Account SID
- Auth Token
- From Number
When entering the Auth Token, the textbox will appear empty. This is because the Auth Token is treated like a password and is encrypted in the database.
Set Up a Rule
Now we have everything configured we need an Event to happen so we can fire off a message. Under Rules, create an event.
In this example, the event will be when a new blog comment has been created.
Next we set up the Action.
The Action will fire an SMS to the administrator of the website but again, this could be an arbitrary number or even a collection of numbers using a comma to separate them. Next fill in the message that will be sent. The message can contain up to 160 characters and can contain tokens.
Now that the Event and Action are set up all that’s left to do is to do is ensure that the default messaging is set to SMS in the general settings and do a test.
Go onto a blog post and submit a comment. You should shortly receive an SMS with the message you wrote.