sendMessage
Send an outbound SMS or MMS message. Returns a
Message object that tracks delivery
state changes. Use await message.wait() to block until the message reaches a
terminal state (delivered, undelivered, or failed).
At least one of body or media must be provided. Providing both sends an MMS
with text and attached media.
Parameters
to
Destination phone number in E.164 format (e.g., "+15559876543").
from
Sender phone number in E.164 format. Must be a number owned by your SignalWire project.
context
Context for receiving state-change events for this message. Defaults to the
server-assigned relay protocol string, or "default" if no protocol has been
assigned yet.
body
Text body of the message. Required for SMS. Optional for MMS if media is provided.
media
List of publicly accessible media URLs for MMS attachments (e.g., images, audio files).
tags
Optional tags to attach to the message for filtering or tracking.
region
Origination region for the message.
onCompleted
Callback function invoked when the message reaches a terminal state
(delivered, undelivered, or failed). Receives the terminal
event as its argument.
Returns
Promise<Message> — A message object in the "queued" state. Use await message.wait() to block until delivery confirmation.