Skip to main content

SignalWire.Relay.MessagingAPI

This represents the API interface for the Messaging Relay Service. This object is used to make requests related to managing SMS and MMS messages.

Methods

Send

Send an outbound SMS or MMS message.

Parameters

ParameterTypeRequiredDescription
contextstringrequiredThe context to receive inbound events.
tostringrequiredThe phone number to send to.
fromstringrequiredThe phone number to place the message from. Must be a SignalWire phone number or short code that you own.
sourceSignalWire.Relay.Messaging.SendSourcerequiredThe message. May be populated by a body string or a list of media URLs.
tagsList<string>optionalTags to tag the message with for searching in the UI.
Default: Empty

Returns

SignalWire.Relay.Messaging.SendResult - The result object to interact with.

Examples

Send a message.

SendResult resultSend = client.Messaging.Send(validContext, "+1XXXXXXXXXX", "+1YYYYYYYYYY");

if (resultSend.Successful)
{
// Message has been queued, you can subscribe to MessagingAPI.OnMessageStateChange to receive further updates
}

Events

All these events can be used to track the message lifecycle and instruct SignalWire on what to do for each different state.

State Events

To track the state of a sent message.

PropertyDescription
OnMessageStateChangeThe message is changing state, generalized event for the following events.
OnMessageDeliveredThe message has been delivered. Due to the nature of SMS and MMS, receiving a delivered event is not guaranteed, even if the message is delivered successfully.
OnMessageFailedThe message delivery failed.
OnMessageInitiatedThe message delivery has been started.
OnMessageQueuedThe message has been put into the queue for delivery.
OnMessageSentThe message has been sent for delivery.
OnMessageUndeliveredThe message has not been delivered. Due to the nature of SMS and MMS, receiving an undelivered event is not guaranteed, even if the message fails to be delivered.

Receive Events

PropertyDescription
OnMessageReceivedA message has been received.