我可以在 AWS API 的哪个位置设置发送短信的发件人 ID
Where in the AWS API can I set the sender id for sending SMS
我试图在我的 API 呼叫中设置发件人 ID,但它被忽略了。
我在哪里放 it/what 是正确的属性名称?
我在美国,下面是我尝试设置发件人 ID 的两个地方(我尝试了 SenderID 和 DefaultSenderID)
$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
中的 Space。
SenderID
不是 publish()
命令中的有效参数。它似乎也没有将其识别为 publish()
命令中的 MessageAttribute
。
我试图在我的 API 呼叫中设置发件人 ID,但它被忽略了。 我在哪里放 it/what 是正确的属性名称? 我在美国,下面是我尝试设置发件人 ID 的两个地方(我尝试了 SenderID 和 DefaultSenderID)
$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
中的 Space。
SenderID
不是 publish()
命令中的有效参数。它似乎也没有将其识别为 publish()
命令中的 MessageAttribute
。