I am using AWS-SDK for Node.js and I would like to change the SMS type when using the SNS publish method, i.e. from Promotional to Transactional. 
I know I have to use the MessageAttributes property but the documentation is not quite clear how I should do this.
What parameter or property should I add to MessageAttributes object/map?
The notification message sent by Amazon SNS for deliveries over HTTP, HTTPS, Email-JSON and SQS transport protocols will consist of a simple JSON object, which will include the following information: MessageId: A Universally Unique Identifier, unique for each notification published.
Sign in to the Amazon SNS console . In the left navigation pane, choose Topics. On the Topics page, select a topic, and then choose Publish message. The console opens the Publish message to topic page.
You can use Amazon SNS to send text messages, or SMS messages, to SMS-enabled devices. You can send a message directly to a phone number, or you can send a message to multiple phone numbers at once by subscribing those phone numbers to a topic and sending your message to the topic.
After a long search this is what worked for me:
AWS = require('aws-sdk')
(new AWS.SNS()).publish({
   Message: 'Message',
   PhoneNumber: '+XXX',
   MessageAttributes: {
    'AWS.SNS.SMS.SMSType': {
       DataType: 'String',
       StringValue: 'Transactional'
    }
 });
The attribute you must add is 'AWS.SNS.SMS.SMSType'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With