在AWS API中,我可以在哪里设置发送SMS的发件人id



我正在尝试在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,但我是一个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

最新更新