【问题标题】:Where in the AWS API can I set the sender id for sending SMS我可以在 AWS API 的哪个位置设置发送短信的发件人 ID
【发布时间】:2020-03-30 11:25:03
【问题描述】:

我正在尝试在我的 API 调用中设置发件人 ID,但它被忽略了。 我应该把它放在哪里/正确的属性名称是什么? 我在美国,以下是我尝试设置发件人 ID 的两个地方(我尝试了 SenderIDDefaultSenderID

    $result = $SnSclient->SetSMSAttributes([
        'attributes' => [
            'DefaultSMSType' => 'Transactional',
            'AWS.SNS.SMS.SenderID' =>'CompanyBrand'

        ],
    ]);
    var_dump($result);//this currently gives an error (method call, not the var_dump)

    $result = $SnSclient->publish([
        'Message' => $message,
        'PhoneNumber' => $phone,
        'SenderID' => 'CompanyBrand'
    ]);

【问题讨论】:

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


    【解决方案1】:

    我知道您使用 PHP,但我是 Python 人。只是为了比较,这段代码对我有用:

    import boto3
    
    sns_client = boto3.client('sns')
    
    response = sns_client.set_sms_attributes(
        attributes={
            'DefaultSenderID': 'Foo'
        }
    )
    print(response)
    
    sns_client.publish(Message='Hello',PhoneNumber='+xxx')
    

    我注意到它不喜欢在DefaultSenderID 中有空格。

    SenderID 不是publish() 命令中的有效参数。在publish() 命令中,它似乎也没有将其识别为MessageAttribute

    【讨论】:

    • 足够好了 - 我精通 Python,应该很容易翻译。你的答案是针对澳大利亚的吗?
    • 我在澳大利亚进行了测试,但它没有特定于特定国家/地区的内容。诚然,情况可能因电信公司甚至手机操作系统而异。
    • :-( 好像在美国不支持
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多