jeudi 2 juin 2016

How to send push notification from web to iOS and android device using AWS SNS in Laravel 5.1?

I have coded like,

$sns = App::make('aws')->createClient('sns');

    $data = json_encode([
        'APNS' => ['apns' => [
                'alert' => $message
            ]
        ]
    ]);

    Log::info($data);

    $sns->publish(array(
        'Message' => $data,
        'TargetArn' => "arn:aws:sns:us-west-2:360542326270:endpoint/APNS_SANDBOX/Testtest/20a75cd1-da25-3331-8126-4db497cbdd5e"
    ));

I'am getting the error as below:

[Aws\Sns\Exception\SnsException]                                                                                                                                                        

Error executing "Publish" on "http://ift.tt/19difur"; AWS HTTP error: Client error: POST http://ift.tt/19difur resulted in a 400 Bad Request response:

  <Type>Sender</Type>                                                                                                                                                                 
  <Code>InvalidPara (truncated...)                                                                                                                                                    

InvalidParameter (client): Invalid parameter: TargetArn Reason: No endpoint found for the target arn specified -

  <Type>Sender</Type>                                                                                                                                                                 
  <Code>InvalidParameter</Code>                                                                                                                                                       
  <Message>Invalid parameter: TargetArn Reason: No endpoint found for the target arn specified</Message>                                                                              

<RequestId>18937e90-5453-5e30-bf89-315a59c3f2af</RequestId>                                                                                                                           

[GuzzleHttp\Exception\ClientException]
Client error: POST http://ift.tt/19difur resulted in a 400 Bad Request response:

  <Type>Sender</Type>                                                                             
  <Code>InvalidPara (truncated...) 

Can anyone help me to find the solution? Thanks in advance..



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire