# WBB Twilio Integration

This project allows you to send SMS messages via the Twilio service, when a block is triggered. Messages sent can make use of static parameters or values collected from forms.

## Setup

After importing the content for this integration you will be provided with a series of blocks that you can use within your content. You will need to configure these blocks to provide the necessary access tokens to use Twilio. [This article](https://support.twilio.com/hc/en-us/articles/223136027-Auth-Tokens-and-How-to-Change-Them) explains how you can find your access tokens required.

## Blocks Provided

This integration provides the following blocks under the topic of `Twilio`.

- Send SMS - when triggered, will send the SMS message to the number provided.
- ?? Account ID not set type blocks?

## Handler Names

The following handler names and their functions are available :

| Handler Name | Block    | Purpose                              |
| ------------ | -------- | ------------------------------------ |
| send-sms     | Send SMS | To trigger an SMS message to be sent |

## Configuration Options

Within the function there are a number of options that can be set to configure the behaviour of the integration. The tables below show the settings that are available for each handler.

### send-sms

| Property          | Required | Description                                                                                                                                                                                                                                         |
| ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| twilioAccountSid  | true     | The account SID from your twilio account that will be used to send the message                                                                                                                                                                      |
| twilioAuthId      | true     | The account Auth ID from your twilio account that will be used to send the message                                                                                                                                                                  |
| to_property       | false    | The name of a property in a form, that is collecting a mobile phone number to send a message to                                                                                                                                                     |
| from              | true     | The mobile phone number that will be used to send the message                                                                                                                                                                                       |
| to                | false    | A fixed mobile phone number to send the message to                                                                                                                                                                                                  |
| message           | true     | The message you'd like to send. Note that this can include parameters that will be substituted when the message is created. For example, "Hello %%firstName%%" might end up sending "Hello Andy" if the user has entered their first name as "Andy" |
| errorBlock        | true     | The block ID that will display an errot to the user if anything goes wrong                                                                                                                                                                          |
| confirmationBlock | true     | The block the user will be shown after the message has been sent successfully                                                                                                                                                                       |
