Groovy Script: Send a SMS notification through Twilio

This Groovy script is called from an ExpressionRule of type 'Alarm'. For example, in an Expression rule

IF: Alarm.severity > 500
THEN: ExecuteCustomObject("SMSMe", "[numberToSMS]")

calls the script "SMSMe" with the parameter phoneNumber.  The ExecuteCustomObject provides a way to call from this simple two-line business rule into a modern programming environment with access to the complete Platform SDK, as well as all the features of the Groovy language.  In Groovy, it's straightforward to use the built-in httpclient library to POST an HTTP request to Twilio to send an SMS to the specified cellphone number.

Groovy Scripts

The groovy script named SMSMe is executed by the Expression Rule above and connects to the Twilio Server passing in a list of parameters.

When you register with Twilio, you will be given an ACCOUNT SID (apiID) and an AUTH TOKEN (apiPass). These two strings need to be in the Groovy Script below:
String apiID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'   
String apiPass = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 

Parameters

Variable Name       Display Name
phoneNumber      phoneNumber