"Twilio" (Service Connection)
"Twilio" (Service Connection)
Connecting & Authenticating
ServiceConnect["Twilio"] creates a connection to the Twilio API. If a previously saved connection can be found, it will be used; otherwise, a new authentication request will be launched.
Requests
ServiceExecute["Twilio","request",params] sends a request to the Twilio API, using parameters params. The following give possible requests.
Send SMS/MMS
"Send" — send SMS or MMS for a given phone number
| "From" | (required) | a registered Twilio phone number or alphanumeric sender ID | |
| "To" | (required) | destination phone number; requires "+" and country code (e.g. +12225551212) | |
| "Body" | None | message body (maximum 1600 characters) | |
| "MediaURL" | None | URL for media to send with message (supports .gif, .png, and .jpeg) |
Message Status
"MessageStatus" — information about a specific message
| "MessageSID" | None | unique 34-character Twilio message SID |
List Messages
"ListMessages" — list of messages sent from your account
| "From" | None | a registered Twilio phone number or alphanumeric sender ID | |
| "To" | None | destination phone number; requires "+" and country code (e.g. +12225551212) | |
| "Date" | None | date messages were sent |
Examples
Basic Examples (4)
twilio = ServiceConnect["Twilio"]twilio["Send", {"To" -> "+5551112222", "From" -> "+5551112223", "Body" -> "Hello World!"}][{"Status", "ErrorCode", "Body"}]ServiceExecute["Twilio", "Send", {"To" -> "+5551112222", "From" -> "+5551112223", "Body" -> "This was sent from the Wolfram Language", "MediaURL" -> "https://wolfr.am/1aVWdQ7bi"}][{"SID", "Status", "Body"}]ServiceExecute["Twilio", "MessageStatus", {"MessageSID" -> "MM8230fc51c47f505b6301fef23fc9b624"}][{"Status", "Body"}]Normal@ServiceExecute["Twilio", "ListMessages", {"To" -> "+5551112222", "Date" -> "2025-08-05"}]["Messages", ;; 4, {"Status", "Body"}]