DEV Community

Tao Liu
Tao Liu

Posted on • Updated on

How to setup a Twilio Hello SMS

Go to Functions:

Alt Text

Create a SMS function:

Alt Text

exports.handler = function(context, event, callback) {
    context.getTwilioClient().messages.create({
      to: '+1253xxxxxxx',         
      from: '+1256906xxxx',       //twilio number
      body: 'New Student Recieved'
    }).then(msg => {
      callback(null, msg.sid);
    }).catch(err => callback(err));
  }
Enter fullscreen mode Exit fullscreen mode

Now just visit your */sms API to send the SMS!

Top comments (0)