October 1, 2022

Robotic Notes

All technology News

Workflows Template: Send SMS with Twilio – Java Code Geeks

2 min read

Workflows templates are out-of-the-box flows and automations that you can add and start using right away. Each template provides a specific and real world solution.

In this blog post you will learn about the Send SMS with Twilio template.

Why it’s important

Within a workflow you may want to send a message, an alert, a pin, or any type of information via SMS to a user.

Template overview

This flow creates a text message and sends it via Twilio SMS API. The flow is meant to be called as a helper flow. This means you can call it from any other flow.

The template has one flow:

  • SUB – Send SMS via Twilio

Template flow steps

Note: I removed a number of Notes cards from the flow (s) so all all cards can fit into a screenshot.

Sending SMS flow

The flow SUB – Send SMS via Twilio has the following steps:

  1. The On Demand – Child Flow card makes this flow a helper flow. This means the flow can be invoked from any other low. This helper flow has four inputs:
    1. To phone number
    2. message
    3. Twilio Account SID
    4. From phone number
  2. The second card Object – Constructcreates an object (JSON object) with required header information for Twilio SMS API call
  3. The third card, Text – Compose puts together additional parameters to be used with Twilio SMS call. The card concatenates To phone number, messageand From phone number information
  4. The next Text – Compose card sets the Twilio endpoint with the Account SID information
  5. The last card, API Connector – Post makes an API call to Twilio to send the text message

Flow chart for the two flows looks like this:

Sending SMS flow chart

Twilio account

You need a Twilio account with a number from which you can send SMS messages. In your Twilio account go to the console. There you will see the information you need to send SMS messages. You will need Account SID, Auth Token and My Twilio phone number.

Twilio account information

Template setup

How to add and setup the template.

Running the flow

To test the flow click the Test button and enter the input that the flow requires.

Note that From phone number is your Twilio number.

Source link