0

Hi I am trying to send a message using AWS Pinpoint with the PHP SDK, but I am getting an error. Any ideas why? Here is my code:

    $client = new PinpointClient([
        'version' => 'latest',
        'region'  => 'us-east-1',
        'credentials' => [
            'key'    => 'MYIAMAWSKEY',
            'secret' => 'MYAWSSECRET',
        ]
    ]);

    $result = $client->sendMessages([
        'ApplicationId' => 'MyAppId',
        'MessageRequest' => [
            'Addresses' => [
               'AnIOSDeviceToken' => [
                    'BodyOverride' => 'aaa',
                    'ChannelType' => 'APNS',
                    'RawContent' => 'bbb',
                    'Context' => ['ccc' => '222'],
                    'TitleOverride' => 'ddd',
                ],
            ],
        ],
        'MessageConfiguration' => [
            'APNSMessage' => [
                    'Action' => 'OPEN_APP',
                    'Body' => 'Hello',
                    'RawContent' => 'World',
                    'SilentPush' => false,
                    'Title' => 'Hello World!!!',
                ],
        ],
    ]);

I get the following error:

DeliveryStatus: 'PERMANENT_FAILURE'
StatusCode: 400
StatusMessage: Invalid notification: Notification is malformed
aksyuma
  • 2,957
  • 1
  • 15
  • 29
awavi
  • 837
  • 3
  • 11
  • 23

1 Answers1

1

According to the API Docs, 'MessageConfiguration' needs to be inside the 'MessageRequest' field. Please make sure your input parameters fully match the documented API Parameter Syntax.

Kevin Stich
  • 773
  • 1
  • 8
  • 24