send_sms
send_sms Sends a text message (SMS) to a phone number: a sign-in code, a reminder, a notice.
Runs on: the server only. The statement that calls it runs on the server, and its result is a server-side value: the server keeps it, the device never writes it, and it is copied to the device only when a device statement reads it.
SMS Server resource required
This function sends nothing unless the project's SMS Server role names a resource (a Twilio account, Resources in the editor, then the project's settings).
Format:
send_sms(to, body)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| to | string | The phone number, in international form when it is not a North American number (e.g. "+14155551234") |
| body | string | The text of the message (1600 characters at most; a long one goes as several segments) |
Returned Value:
| Type | Description |
|---|---|
| string | "OK" if the message was accepted for delivery, or an error message |
Examples
r = send_sms(customer.phone, "Your table is ready at " + restaurant.name)