2017-09-15 25 views
0

次のコードはメッセージの送信に使用しますが、到着すると、送信者IDに「VERIFY」という文字列が表示されます。送信者IDを特定するにはどうすればよいですか?私はそれがメッセージの属性で終わったと思うが、私は構文を理解することはできません。boto3 - aws sns - 送信者IDを指定

session = boto3.session.Session(profile_name='Credentials',region_name='us-east-1') 
theMessage='Now is the time for all good people to come to the aid of their party' 
senderID='Godzilla' 
snsclient = session.client('sns') 
response = snsclient.publish(PhoneNumber='+84932575571', Message=theMessage) 
pp = pprint.PrettyPrinter(indent=4) 
print(pp.pprint(response)) 

答えて

4

3つ目のパラメータMessageAttributesをpublishメソッドに追加します。

snsclient.publish(PhoneNumber='+84932575571', Message=theMessage,MessageAttributes={ 
'AWS.SNS.SMS.SenderID': { 
    'DataType': 'String', 
    'StringValue': 'Godzilla' 
}}) 

送信者IDは多くの国でサポートされていません。 AWS SNS SMS SenderId Supported Countries

+0

ありがとうございます...米国またはベトナムではサポートされていません。 – Vietyank

関連する問題