AWS SNS消息未传递,但状态为OK

时间:2018-09-25 18:10:53

标签: php amazon-web-services amazon-sns

我已经配置了AWS以将消息发送到电话。我正在使用PHP zend框架。代码看起来像这样,

$client = new \Aws\Sns\SnsClient([
        'version' => 'latest',
        'region' => 'us-west-2',
        'credentials' => [
          'key' => $client_id,
          'secret' => $client_secret,
        ],
      ]);
      $array = array('attributes' => array('DefaultSenderID' => 'test', 'DefaultSMSType' => 'Transactional'));
      $client->setSMSAttributes($array);
      $client->publish([
        'Message' => $message, // REQUIRED
        'PhoneNumber' => $phone,
        'Subject' => 'Test',
      ]);

'client_id'和'client_secret'很好。如果我打印publish方法的结果,看起来像这样,

object(Aws\Result)#518 (1) {
  ["data":"Aws\Result":private]=>
  array(2) {
    ["MessageId"]=>
    string(36) "4ae4a70d-1df7-5f23-a7df-f32964153c75"
    ["@metadata"]=>
    array(4) {
      ["statusCode"]=>
      int(200)
      ["effectiveUri"]=>
      string(35) "https://sns.us-west-2.amazonaws.com"
      ["headers"]=>
      array(4) {
        ["x-amzn-requestid"]=>
        string(36) "3f370b92-e885-52cc-8fff-5fb69167619a"
        ["content-type"]=>
        string(8) "text/xml"
        ["content-length"]=>
        string(3) "294"
        ["date"]=>
        string(29) "Tue, 25 Sep 2018 18:00:02 GMT"
      }
      ["transferStats"]=>
      array(1) {
        ["http"]=>
        array(1) {
          [0]=>
          array(0) {
          }
        }
      }
    }
  }
}

状态似乎正常(200),但是没有传递消息。我该如何解决这个问题?

0 个答案:

没有答案