Send Result

View as Markdown

Relay.Messaging.SendResult

This object returned from send method that represents the result of a send operation.

Properties

NameTypeDescription
successfulbooleanWhether the send operation has successfully queued the message.
messageIdstringThe ID of the message.

Methods

getMessageId

Returns the ID of the queued message.

Parameters

None

Returns

string - Message ID.

Examples

Send a message and retrieve the ID.

1<?php
2
3$params = [
4 'context' => 'office',
5 'from' => '+1XXXXXXXXXX',
6 'to' => '+1YYYYYYYYYY',
7 'body' => 'Welcome at SignalWire!'
8];
9$client->messaging->send($params)->done(function($sendResult) {
10 if ($sendResult->isSuccessful()) {
11 $messageId = $sendResult->getMessageId();
12 }
13});

isSuccessful

Return true if the message was queued, false otherwise.

Parameters

None

Returns

boolean - True/False accordingly to the state.

Examples

Send a message and then check if there were errors.

1<?php
2
3$params = [
4 'context' => 'office',
5 'from' => '+1XXXXXXXXXX',
6 'to' => '+1YYYYYYYYYY',
7 'body' => 'Welcome at SignalWire!'
8];
9$client->messaging->send($params)->done(function($sendResult) {
10 if ($sendResult->isSuccessful()) {
11 // ..
12 }
13});