Downstream Response

Introduction

To get the response of a downstream request, just save the return of the sendTo() method into a variable.

$response = $fcm->sendTo(['1', '2', '3', '4']);

You have seven methods available to read downstream response:

  • getNumberSuccess(): Return the number of messages that were processed without an error.
$response->getNumberSuccess();
  • getNumberFailure(): Return the number of messages that could not be processed.
$response->getNumberFailure();
  • getNumberModify(): Return the number of results that contain a canonical registration token.
$response->getNumberModify();
  • getTargetsToDelete(): Return an array of tokens that you should remove in your database.
$response->getTargetsToDelete();
  • getTargetsToModify(): Return an array of tokens (key : old token, value : new token) that you should change in your database.
$response->getTargetsToModify();
  • getTargetsToRetry(): Return an array of tokens you should try to resend the message.
$response->getTargetsToRetry();
  • getTargetsWithError(): Return an array of tokens that could not be processed with their error.
$response->getTargetsWithError();

For more details on downstream response, refer to the FCM documentation