Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including noflo-twilio with all npm packages installed. Try it out:

var nofloTwilio = require("noflo-twilio")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

noflo-twilio v0.1.1

Wrapper around the twilio API

Twilio wrapper
Build Status Dependency Status NPM version Stories in Ready

Wrapper around the twilio API

This package is incomplete. Please contribute new components and graphs. I'll try to incorporate as soon as time allows.

Testing

This package requires manual testing because Twilio only allows private keys for testing. See https://www.twilio.com/docs/api/rest/test-credentials for more information.

Run grunt test:all to test manually.

Usage

Client

Create a twilio client object given the account ID and the auth token of your twilio account.

In-ports

  • ACCOUNT: the account ID
  • TOKEN: the auth token

Out-ports

  • OUT: a twilio client object

Sms

Send/Receive SMS messages. See the twilio doc on receiving SMS messages and sending SMS messages for more information.

In-ports

  • CLIENT: the twilio client created by Client component
  • SEND: the POST parameters as outlined in the doc; each packet is an object of parameters. Multiple packets send multiple SMS messages
  • RECEIVE: message SIDs; each packet is a string of an SID. An empty connection with no packets or no packets of SID strings which start with "SM" lists all messages

Out-ports

  • OUT: a message object for each incoming packet. See doc for what would be in a returned object

Examples

(Adapted from the twilio doc) Send an SMS from 415-814-1829 to 415-935-2345 begging Jenny for a second chance and print the returned object to screen.

ClientGen(twilio/Client) OUT -> CLIENT Sms(twilio/Sms)
'{"body":"Jenny please?! I love you <3","to":"+14159352345","from":"+14158141829"}' OUT -> IN Message(string/ParseJson)
Message() OUT -> SEND Sms() OUT -> IN Output(Output)

Getting two messages by their SIDs.

ClientGen(twilio/Client) OUT -> CLIENT Sms(twilio/Sms)
'SM800f449d0399ed014aae2bcc0cc2f2ec\nSM800f449d0399ed014aae2bcc0cc2f2ed' OUT -> IN Sids(SplitStr)
Sids() OUT -> RECEIVE Sms() OUT -> IN Output(Output)

Listing all messages.

ClientGen(twilio/Client) OUT -> CLIENT Sms(twilio/Sms)
'' -> RECEIVE Sms() OUT -> IN Output(Output)
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free