# Twilio

Category: Platforms
|
Runtime: 0.9+
|
Available: Free

# Overview

Twilio node by Kumologica integrates with Twilio cloud messaging platform for sending SMS and for automated voice messages.

# Setup

# Prerequisites

For Twilio node to work properly, you need to have a valid subscription of Twilio account (opens new window) and available to access over https. Ensure to have the Account SID and API key (opens new window) generated for the node to connect with a given instance of Twilio cloud platform.

# Installation

To install the node from designer:

  1. Go to Add more nodes option on the palette section.
  2. Check for the Twilio node and click install.
  3. Once installed, the designer is required to be restarted.

To install the node from CLI:

  1. Go to your project workspace where you can see your package.json file.
  2. Run the below give npm command.
    npm i @kumologica/kumologica-contrib-twilio

# Technical Details

Properties

  • Operation (Required)
    Option for selecting SMS or Voice message.
  • Message (optional)
    Message to be send as SMS.
  • To Number (optional)
    Twilio verified phone number to which message needs to be sent. One phone at a time supported. Number to be verified via Twilio account console.
  • To Numbers (optional)
    Twilio verified phone numbers provided as comma separated values. Multiple phone numbers supported at a time. Number to be verified via Twilio account console.
  • From Number (optional)
    Twilio generated phone number.
  • Notify SID (optional)
    SID associated with Notify service in Twilio created for sending bulk SMS.
  • Account SID (Required)
    Account number associated with your Twilio account in order to connect with the platform.
  • API Key (Required)
    API key to authenticate against the Twilio account.
    512 mb is the minimum memory requirement for your AWS lambda deployment when using Twilio node.

Supported Operations

Throws

Twilio node throws the following exception.

  • Twilio Client Failed

Returns

Unique reference sid would be generated as response for each SMS events or Voice call events. The reference sid can be accessed using msg.header.twilio.sid expression. Notification sid can be accessed using msg.header.twilio.nsid.

# Develop a Service

Video tutorial

# Instructions

  1. Drag a drop an EventListener node from the palette to the canvas. Open the settings, configure the following and Save.

    Display Name : POST /order/sms
    Event Source : Amazon API gateway
    Verb : POST
    URL : /order/sms
    
  2. Add a logger from the palette to the canvas and set the Message as msg.payload.

  3. From the platforms category add Twilio node to the canvas. Open the settings, configure the following and Save.

    Account SID : Account SID from your Twilio account 
    API Key : API key to authenticate with your Twilio account
    Operation: SMS
    Message: msg.payload.smsdata
    To Number : Twilio verified number
    From Number : Twilio allocated number
    
  4. Wire the EventListener node to the Logger node and wire logger node to Twilio node.

  5. Add EventListener End node from the palette to the canvas. Open the settings, configure the following and Save.

    Content-Type : application/json
    Payload : msg.payload
    
  6. Wire the Twilio node to EventListener End node.

# Try it

Sample Flow for SMS notification using Twilio