Twilio SMS Messaging — Axway Titanium Cross-Platform Library

Adam Armstrong
Jul 26, 2017 · 2 min read

I have integrated Twilio SMS Messaging for various clients over the past few years and decided it was time to wrap this up into my own library to ease portability.

For this library — I took a very simplistic approach. Just added SMS Messaging and no SDK’s or additional libraries; just a basic common.js module.

Setup Twilio Account and API Key

  1. Create an API Key at https://www.twilio.com/console/video/dev-tools/api-keys

Make note of your API Secret. After you complete the setup the API Key can no longer be retrieved.

Download Library

https://github.com/adamtarmstrong/ti.twilio

Add Module and Initialize

  • timeout = {integer} to define API timeout in milliseconds
  • FROM_PhoneNumber = {string} in E.164 format of phone # to send message FROM (ie. +15005550006')

NOTE: FROM_PhoneNumber passed in must match the API Key Environment (more details in github repo)

var twilioClient = require('ti.twilio');
twilioClient.init('AccountSID', 'APISID', 'APISecret', 'FROM_PhoneNumber', timeout);

Send SMS Message

  • TO_PhoneNumber = {string} in E.164 format of client phone # to send message TO (ie. +146921439389')
  • successCallback = {function} to execute upon success
  • failureCallback = {function} to execute upon failure
twilioClient.sendSMS(Message, TO_PhoneNumber, successCallback, failureCallback);

That’s it!

This is just a basic SMS Message and I plan to expand the methods over time. Code contributions are greatly appreciated!

Adam T Armstrong

Mobile Developer and IT Manager

Adam T Armstrong

Mobile Developer and IT Manager

Adam Armstrong

Written by

Web Designer, Mobile App Developer, IT Manager & Fitness Guru

Adam T Armstrong

Mobile Developer and IT Manager