Reputation: 33
I'm trying to use AWS SNS to publish message to mobile endpoints, However there are two types of messaging: promotional (the default one) and the Transactional which is the more reliable one.
I'm having issues setting the SNS client's attributes so that all message are Transactional to make sure messages are delivered to mobile phones. I appreciate if any could help me out with this. Below is my code:
SMSAWSClient = boto3.client(
"sns",
aws_access_key_id="My Key",
aws_secret_access_key="My Secret Key",
region_name="us-east-1"
)
SMSAWSClient.set_sms_attributes(
attributes={
'DefaultSMSType': 'Transactional'
}
)
Now when I run the program I get the following error:
"botocore.errorfactory.InvalidParameterException: An error occurred (InvalidParameter) when calling the SetSMSAttributes operation: Invalid parameter: "
This is the code I use to publish message:
SMSAWSClient.publish(PhoneNumber="Phone Number",Message="Message Body")
Thanks in advance.
Upvotes: 0
Views: 1208
Reputation: 11
Set the attributes on a single line
SMSAWSClient.set_sms_attributes(attributes={'DefaultSMSType': 'Transactional'})
or
SMSAWSClient.set_sms_attributes(attributes={'DefaultSenderID': 'Sender', 'DefaultSMSType': 'Transactional' })
Upvotes: 1