Skip to main content

Relay::Messaging

This namespace represents the API interface for the Messaging Relay Service. It is used to send and receive text messages.

Methods

send

Send an outbound SMS or MMS message.

Parameters

ParameterTypeRequiredDescription
toStringrequiredThe number you are attempting to send the message to.
fromStringrequiredThe phone number to place the message from. Must be a SignalWire phone number or short code that you own.
contextStringrequiredThe SignalWire context on which you will receive updates about the message state.
bodyStringoptionalThe text body to send. Either body or media must be specified.
mediaArrayoptionalAn array of media URLs to send with an MMS. Either body or media must be specified.
tagsArrayoptionalAn array of tags to tag the message with. For searching in the UI and identifying messages.

Returns

Signalwire::Relay::Messaging::SendResult - the result of the send command.

Examples

Send a message in the office context.

result = client.messaging.send(
from: '+1XXXXXXXXXX',
to: '+1YYYYYYYYYY',
context: 'office',
body: 'SignalWire says hello!'
)

puts "Message #{result.message_id} was successfully sent" if result.successful