- Stitch >
- External Services >
- Built-In Services >
- Twilio Service
twilio.send()¶
Important
The MongoDB Stitch SDK is deprecated. For guidance on migrating to MongoDB Realm, please see Migrate Your App from Stitch to Realm.
On this page
Usage¶
Example¶
Note
To send or receive messages via the Twilio API for WhatsApp,
prepend the to
or from
numbers with whatsapp:
.
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
Parameters¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
Parameter | Type | Description |
---|---|---|
args |
document | A document of the following form: |
args.to |
string | The recipient’s phone number in E.164 Format. |
args.from |
string | A phone number associated with your Twilio account in E.164 Format. |
args.body |
string | The message to send. |
Parameter | Type | Description |
---|---|---|
to |
string | The recipient’s phone number in E.164 Format. |
from |
string | A phone number associated with your Twilio account in E.164 Format |
body |
string | The message to send. |
Parameter | Type | Description |
---|---|---|
to |
String | The recipient’s phone number in E.164 Format. |
from |
String | A phone number associated with your Twilio account in E.164 Format. |
body |
String | The message to send. |
Parameter | Type | Description |
---|---|---|
to |
String | The recipient’s phone number in E.164 Format. |
from |
String | A phone number associated with your Twilio account in E.164 Format. |
body |
String | The message to send. |
Return Value¶
The twilio.send()
action does not return a value.
Rule Templates¶
Users Can Send Only Messages From a Specific Phone Number¶
Users Can Only Send Messages To a Limited Set of Phone Numbers¶
Users Can Only Send Messages to Themselves¶
Note
This template calls an example function named
isCurrentUsersPhoneNumber
that does the following:
- Accepts the phone number provided in the
to
argument - Queries MongoDB for a user document that matches the current user’s id
- Compares the provided phone number to the number listed in the user document
- Returns the boolean result of the comparison