Workflows Template: Send SMS with Twilio
Tags: nocode, workflows, okta, twilio
Published: 2022-08-25 18:54:51

---
title: Workflows Template: Send SMS with Twilio
published: true
date: 2022-04-21 16:32:53 UTC
tags: NoCode,Workflows,okta, Twilio
canonical_url: https://maxkatz.net/2022/04/21/workflows-template-send-sms-with-twilio/
---

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](https://github.com/okta/workflows-templates/blob/master/workflows/send_sms_via_twilio/readme.md) 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 messages 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](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio1.png?w=1024)](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio1.png)
<figcaption>Sending SMS flow</figcaption>

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 – Construct** , creates 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`, `message`, and `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](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio_flowchart.png?w=956)](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio_flowchart.png)
<figcaption>Sending SMS flow chart</figcaption>

## Twilio account

You need a [Twilio account](https://www.twilio.com/try-twilio) with a number from which you can send SMS messages. In your Twilio account go to the [console](https://console.twilio.com/). 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](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio_account2.png?w=782)](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio_account2.png)
<figcaption>Twilio account information</figcaption>

## Template setup

How to add and setup the template.

1. In Workflows console click **Templates**
2. In the search field start typing _sms_ and then select **SMS with Twilio** template
3. Click **Add template** button
4. Set a connection in **API Connector – Post** card for Twilio by creating a new connection:
  1. **Auth Type** : `Basic`
  2. **Username** : `Account SID` from Twilio console
  3. **Password** : `Auth Token` from Twilio console  
  
 ![Twilio connection](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio_connection.png)<figcaption>Twilio connection</figcaption>

## Running the flow

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

[![Testing the flow](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio_test.png?w=815)](https://katzmax.files.wordpress.com/2022/04/workflows_template_twilio_test.png)
<figcaption>Testing the flow</figcaption>

Note that **From phone number** is your Twilio number.

* * *

🎁 Looking for more out-of-the-box automation solutions? Check out all the available [templates](https://help.okta.com/wf/en-us/Content/Topics/Workflows/templates/templates-list.htm).