【问题标题】:How to send messages using AWS Pinpoint service using PHP SDK如何使用 PHP SDK 使用 AWS Pinpoint 服务发送消息
【发布时间】:2018-07-27 20:20:26
【问题描述】:

您好,我正在尝试使用带有 PHP 开发工具包的 AWS Pinpoint 发送消息,但出现错误。任何想法为什么?这是我的代码:

    $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!!!',
                ],
        ],
    ]);

我收到以下错误:

DeliveryStatus: 'PERMANENT_FAILURE'
StatusCode: 400
StatusMessage: Invalid notification: Notification is malformed

【问题讨论】:

    标签: aws-php-sdk aws-pinpoint


    【解决方案1】:

    根据the API Docs'MessageConfiguration' 需要在'MessageRequest' 字段内。请确保您的输入参数与记录的 API 参数语法完全匹配。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-18
      • 1970-01-01
      • 2016-12-09
      相关资源
      最近更新 更多