'SenderID' 在 Amazon SNS 上发送短信时出现问题(官方 PHP SDK)

'SenderID' issues sending SMS on Amazon SNS (Official PHP SDK)

出于某种原因,SenderID 似乎恢复为 NOTICE - 请参阅此处 当我在代码中设置 SenderID 时。

当我将 SenderID 变量排除在外时,它将作为默认设置发送 - 这很好,但我们偶尔会更改名称以用于不同的用途。

我正在使用官方 PHP SDK,代码如下:

$aws_cred = array(
    'credentials' => array(
        'key' => 'GOT THE KEY',
        'secret' => 'GOT THE SECRET',
    ),
    'region' => 'eu-west-1', // < your aws from SNS Topic region
    'version' => 'latest'
    );
    $sns = new \Aws\Sns\SnsClient($aws_cred);

    $args = array(
    "SenderID" => "MySendID",
    "SMSType" => "Promotional",
    "Message" => "Amazon y u do dis??",
    "PhoneNumber" => "+number"
    );

    $result = $sns->publish($args);

我正在发送到英国(所以 SID 在那里工作),而且它在 11 个字符的限制内。

有人知道为什么会这样吗?

干杯

(Optional) For Sender ID, type a custom ID that contains up to 11 alphanumeric characters, including at least one letter and no spaces. The sender ID is displayed as the message sender on the receiving device. For example, you can use your business brand to make the message source easier to recognize.

Support for sender IDs varies by country. For example, messages delivered to U.S. phone numbers will not display the sender ID. For the countries that support sender IDs, see Supported Regions and Countries.

If you do not specify a sender ID, the message will display a long code as the sender ID in supported countries. For countries that require an alphabetic sender ID, the message displays NOTICE as the sender ID.

http://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html

总而言之,你不能使用空格(你有一个),它不会总是有效,这取决于国家和运营商,它不会在更多的地方发挥作用

我找到了答案。

搜索系统本来没有实现这个,但我终于找到了。

引用自:

I found the solution. Set the args this way. It works!

$args = array(
    'MessageAttributes' => [
          'AWS.SNS.SMS.SenderID' => [
               'DataType' => 'String',
               'StringValue' => 'YourSenderName'
        ]
     ],
      "SMSType" => "Transactional",
      "PhoneNumber" => "+87654321",
      "Message" => "Hello World!"
);