Skip to content
Send SMS with Twilio from IBM i
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig Create .editorconfig Sep 6, 2017
CRTSMSQ.CLLE
LICENSE Create LICENSE Oct 20, 2016
README.md Update README.md Dec 4, 2018
SNDSMS.SQLRPGLE
sendSMSDataFromQueue.js Update sendSMSDataFromQueue.js Dec 4, 2018

README.md

Send SMS with Twilio from IBM i

How does it work

Twilio provides a Node.js REST API to send SMS messages. This solution give you a simple RPGLE program to send the SMS data to a DataQueue. When the SMS message is sent to the DataQueue a Node.js program is waiting for new SMS messages. Once the message arrived the Node.js program send the message with the Twilio REST-API.

The JSON SMS data from IBM i DataQueue

{"body":"Hello World", "to":"+123456789", "from":"+123456789"}

You need

- Node.js 6.x 5733-OPS Option 10
- Install Twilio Node.js API: npm install twilio
- The Twilio credentials - accountSid, authToken, SMS from number - from www.twilio.com/console

Go here to get started with Node.js on IBM i.

Once you have installed Node.js 6.x set Node.js to V6

5250> qsh
$ /QOpenSys/QIBM/ProdData/OPS/Node6/bin/nodever.sh 6

Check your Node.js version

5250> qsh
$ node -v
v6.9.1  

Enable QRCVDTAQ wait for Node.js

You'll find the Class iDataQueue in the file /QOpenSys/QIBM/ProdData/OPS/Node6/os400/xstoolkit/lib/idataq.js
copy this file to the new file /QOpenSys/QIBM/ProdData/OPS/Node6/os400/xstoolkit/lib/idataq2.js
and change the following statements:

line 70: iDataQueue.prototype.receiveFromDataQueue = function(name, lib, length, wait, cb) {
line 76: pgm.addParam(wait, "5p0");

Manual Install

Create the following Directories

5250> qsh
$ mkdir -p /home/node  (for the sendSMSDataFromQueue.js)

Start the Node.js program on your IBM i

5250> qsh
$ node /home/node/sendSMSDataFromQueue.js
You can’t perform that action at this time.