The Telerik Platform product is retired.Learn more

Sending SMS Text Messages Through Twillio

Sending SMS Text Messages Through Twillio

Telerik Platform also offers integration with Twillio. You can use it to send SMS text messages to your users from within Cloud Code.

twilio.sendSms(fromNumber, toNumber, message, callback);

The meaning of the parameters is explained below:

  • fromNumber - sender's phone number. This number must be one of you numbers in your Twilio account
  • toNumber - recipient's phone number.
  • message - the body of the SMS.
  • callback - function that is invoked on completion of the request.

Here is a sample, demonstrating how to use as a notification mechanism when a new item is created:

Everlive.Events.afterCreate(function(request, response, context, done) {
    //Instantiate Twilio API
    var accountId = '<TwillioAccountId>';
    var authToken = '<TwillioAuthToken>';
    var twilio = new Everlive.Integration.Twilio(accountId, authToken);

    //Send SMS to a specific phone number
    var fromNumber = '+165********'; //One of the numbers in your Twilio account
    var toNumber = '+3598********';
    var message = 'This is automatic SMS from the Friends application.';
    twilio.sendSms(fromNumber, toNumber, message, function(err, result) {
        if (err) {
            // Handle the error here

        } else {
            // some other logic here...

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.