system.twilio.sendSms
This function is used in Python Scripting.
Descriptionβ
Sends an SMS message.
Client Permission Restrictionsβ
This scripting function has no Client Permission restrictions.
Syntaxβ
system.twilio.sendSms(accountName, fromNumber, toNumber, message)
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| String | accountName | The Twilio account to send the SMS from. |
| String | fromNumber | The outbound phone number belonging to the Twilio account to use. |
| String | toNumber | The phone number of the recipient. |
| String | message | The body of the SMS. |
Returnsβ
Nothing
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
Code Snippet
# Send an SMS message.
# Fetch the Twilio account name.
# getAccounts() returns a list, so the "[0]" operator is referring to the first item in the list.
account = system.twilio.getAccounts()[0]
# Fetch the first number associated with the account.
fromNumber = system.twilio.getPhoneNumbers(account)[0]
# Fetch a specific user's contact information.
# A static value is used below, but system.user.getUser() could be used to retrieved a user's phone number.
toNumber = "+19165550101"
# Define the text message.
# A static message is used below, but multiple messages could be stored in a database table and retrieved here.
textMessage = "This is the body of a text message"
# Send the message.
system.twilio.sendSms(account, fromNumber, toNumber, textMessage)