aws4fetch
aws4fetch copied to clipboard
How to use this with AWS SNS to send SMS messages
Hi,
Thanks for the great lib. I have it currently working to send emails through SES from a cloudflare worker. I now was hoping to use the Lib to send SMS messages but after a few days looking through the AWS documentation I am no closer to getting it working.
If by any chance anyone knows if, a) this can work and b) How to do it if it can.
Much appreciated.
edit ------
I found this code on another git ( https://github.com/Sean-Bradley/AWS-SNS-SMS-with-NodeJS ) that uses the aws-sdk npm package.
var AWS = require('aws-sdk');
var params = {
Message: message,
PhoneNumber: '+' + number,
MessageAttributes: {
'AWS.SNS.SMS.SenderID': {
'DataType': 'String',
'StringValue': subject
}
}
};
var publishTextPromise = new AWS.SNS({ apiVersion: '2010-03-31' }).publish(params).promise();
The publish class is defined here.. https://github.com/aws/aws-sdk-js-v3/blob/e3772e0ade/clients/client-sns/SNS.ts#L984