Twilio connector

The Twilio connector is used to integrate with an instance of Twilio to send SMS messages. The Twilio connector is graphically represented by the Twilio logo under the OOTB Connectors menu whilst modeling a process.

The implementation value of the email connector in a service task would be similar to the following:

<bpmn2:serviceTask id="ServiceTask_1che7zm" implementation="emailConnector.SEND" />

Twilio configuration

An account ID and token are required by the connector to access Twilio. These are specific to your Twilio account and act as the authorization credentials.

The values are provided are provided by Twilio when an account is created. They can also be located in the Twilio setup page.

The account ID and authorization token will need to be set as configuration parameters when deploying the Twilio connector.

Configuration parameters

Values for configuration parameters that are specific to a connector instance can be set in the modeling application or during application deployment.

The following are the configuration parameters that need to be set for the Twilio connector:

ParameterDescription
TWILIO_ACCOUNTYour account name obtained from Twilio
TWILIO_TOKENA token for your account obtained from Twilio

Actions

The Twilio connector contains an action called send_sms that sends an SMS message using an external Twilio service.

Input parameters

The following are the parameters that can be passed to the Twilio connector as input parameters using the send_sms action:

ParameterDescriptionTypeRequired?
smsFromThe phone number the SMS will be sent fromStringYes
smsToThe list of numbers the SMS will be sent toStringYes
smsBodyThe SMS message to be sentStringYes

Note: Freemarker templates are supported in smsBody.

Output parameters

The following are the parameters that are returned to the process by the Twilio connector as output parameters using the send_sms action:

Note: The execution of the Twilio connector is always successful. Any errors will be returned in the twilioError parameter. The parameter will be null if there were no errors.

ParameterDescriptionType
twilioResultThe response(s) from the connector containing the ID of the sent messageString
twilioErrorA list of errors if any are caught by the connectorString

Events

The Twilio connector contains an event called SMS_RECEIVED that can be used by a trigger to configure an action when an SMS message meeting a specific pattern is found.

Input parameters

ParameterDescriptionExampleRequired?
patternA regular expression that selects which messages are published as events. Java catching group syntax can be used to create groups from the pattern as variablesOrder Number (?<orderNumber>.+)Yes
echoThe message sent to the original sender if a message is matchedYour reference number is ${orderNumber}No
echoErrorThe message sent to the user if an error occurs publishing the eventThere was a problem publishing that event.No

Note: Any groups created in a pattern can be referenced in echo and echoError using the syntax ${groupName}

Output parameters

ParameterDescriptionTypeRequired?
matchGroupsAny matching groups found using the regular expression in patternJSONNo
originalMessageThe original message that was sentStringNo
toThe recipient of the matched messageStringNo
fromThe sender of the matched messageStringNo

Note: Groups found in matchGroups can be used to map to process variables in a trigger by referencing the variable in a JSON field, for example using ${matchGroups.orderNumber}

© 2023 Alfresco Software, Inc. All Rights Reserved.