Relay.Messaging.SendResult​
This object returned from send
method that represents the result of a send operation.
Properties​
successful | boolean | Whether the send operation has successfully queued the message. |
messageId | string | The 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.
<?php
$params = [
'context' => 'office',
'from' => '+1XXXXXXXXXX',
'to' => '+1YYYYYYYYYY',
'body' => 'Welcome at SignalWire!'
];
$client->messaging->send($params)->done(function($sendResult) {
if ($sendResult->isSuccessful()) {
$messageId = $sendResult->getMessageId();
}
});
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.
<?php
$params = [
'context' => 'office',
'from' => '+1XXXXXXXXXX',
'to' => '+1YYYYYYYYYY',
'body' => 'Welcome at SignalWire!'
];
$client->messaging->send($params)->done(function($sendResult) {
if ($sendResult->isSuccessful()) {
// ..
}
});