By using AWS re:Post, you agree to the Terms of Use
/Amazon Simple Notification Service (SNS)/

Questions tagged with Amazon Simple Notification Service (SNS)

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

2
answers
0
votes
6
views
Arian Calabrese
asked 5 days ago

Passing custom senderID and templateID for AWS SNS in India using NodeJS

So, I am trying to figure out the NodeJS Code for sending SMS to Indian mobile numbers using AWS SNS. I have gotten the code down to sending the SMS but I am not able to map the senderID or the templateID which I have gotten registered. The DLT Template ID has been registered with Airtel DLT Connect and even the entityID has been registered there. I am getting the SMS but with a random senderID, not the one I am assigning. The code snippet is below: ``` var AWS = require('aws-sdk'); var config = { AWS: { accessKeyId: "", secretAccessKey: "", region: "ap-south-1" } } AWS.config.update({ accessKeyId: config.AWS.accessKeyId, secretAccessKey: config.AWS.secretAccessKey, region: config.AWS.region }); var params = { Message: "Your verification code is 123345. This code is valid for 24 hours.", MessageStructure: 'string', PhoneNumber: '+91XXXXXXXXXX', MessageAttributes: { "AWS.SNS.SMS.SenderID": { DataType: 'String', StringValue: 'CustomSenderID' }, "AWS.SNS.SMS.SMSType": { DataType: 'String', StringValue: 'Transactional' }, "AWS.MM.SMS.EntityID": { DataType: 'String', StringValue: 'EntityID' }, "AWS.MM.SMS.TemplateId": { DataType: 'String', StringValue: 'TemplateID' } } }; var sns = new AWS.SNS(); sns.publish(params, function (err, data) { if (err) { console.log(err); } else { console.log(data); } }); ``` So, if I don't pass the EntityID and the templateID, I get the SMS but with a random numeric senderID. When I try to pass it in the example shown above, I get the below error: ``` ParameterValueInvalid: Message attribute names starting with 'AWS.' or 'Amazon.' are reserved for use by Amazon. at Request.extractError (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\protocol\query.js:50:29) at Request.callListeners (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\sequential_executor.js:106:20) at Request.emit (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\sequential_executor.js:78:10) at Request.emit (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\request.js:686:14) at Request.transition (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\request.js:22:10) at AcceptorStateMachine.runTo (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\state_machine.js:14:12) at D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\state_machine.js:26:10 at Request.<anonymous> (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\request.js:38:9) at Request.<anonymous> (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\request.js:688:12) at Request.callListeners (D:\WORK\Agri10x\Development\Projects\dataserver\node_modules\aws-sdk\lib\sequential_executor.js:116:18) { code: 'ParameterValueInvalid', time: 2022-01-06T09:33:30.590Z, requestId: 'dc92b0a1-e561-5ae4-a32d-eaf15ccb3fea', statusCode: 400, retryable: false, retryDelay: 57.53422286102854 } ``` Any help would be appreciated! Thanks in advance!
0
answers
0
votes
1
views
AWS-User-5677981
asked 10 days ago
1
answers
0
votes
6
views
rahul
asked a month ago

SES SNS duplicate notification with different messageID but single email

I've set up SNS with SES and while looking at my logs, I'm seeing duplicate entries for open events but with DIFFERENT messageids, despite only a single email. I am able to verify that it's a single email because I've tested it by sending an email to myself, but moreover, in the logs, the timestamps are almost the exact same time (off by milliseconds). The one interesting thing is the ipAddress is slight different (one ends with .211, and the other with .219) I've attached the record log below of two OPEN records from the same recipient. ``` {'EventSource': 'aws:sns', 'EventVersion': '1.0', 'EventSubscriptionArn': 'arn:aws:sns:us-west-1:12345678765:topic_name:c765a5cf-06cf-44d8-afdc-28b63033c949', 'Sns': {'Type': 'Notification', 'MessageId': '1123745b-e254-5168-962b-2e6f2e7ac2fb', 'TopicArn': 'arn:aws:sns:us-west-1:12345678765:topic_name', 'Subject': 'Amazon SES Email Event Notification', 'Message': '{"eventType":"Open","mail":{"timestamp":"2021-12-16T03:12:53.124Z","source":"redact","sendingAccountId":"12345678765","messageId":"0111017dc13a7384-bd1cf759-6814-418c-bd29-6f981a451a2e-000000","destination":["destination@gmail.com"],"headersTruncated":false,"headers":[{"name":"Date","value":"Thu, 16 Dec 2021 03:12:53 +0000"},{"name":"From","value":"redact"},{"name":"Reply-To","value":"redact"},{"name":"To","value":"destination@gmail.com"},{"name":"Message-ID","value":"<321132367.51541.1639624373206@ip-10-0-33-160.us-west-1.compute.internal>"},{"name":"Subject","value":"subject line"},{"name":"MIME-Version","value":"1.0"},{"name":"Content-Type","value":"text/html; charset=UTF-8"},{"name":"Content-Transfer-Encoding","value":"quoted-printable"}],"commonHeaders":{"from":["redact"],"replyTo":["redact"],"date":"Thu, 16 Dec 2021 03:12:53 +0000","to":["destination@gmail.com"],"messageId":"0111017dc13a7384-bd1cf759-6814-418c-bd29-6f981a451a2e-000000","subject":"subject line"},"tags":{"ses:operation":["SendTemplatedEmail"],"ses:configuration-set":["topic_name"],"ses:source-ip":["redact"],"ses:from-domain":["b.com"],"ses:caller-identity":["caller_id"]}},"open":{"timestamp":"2021-12-16T05:09:02.500Z","userAgent":"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)","ipAddress":"0.0.0.211"}}\n', 'Timestamp': '2021-12-16T05:09:02.554Z', 'SignatureVersion': '1', 'Signature': 'e1swVjH1PFog/9syhhDOvS6BgNZnI3RN6k+fRfkXUaUXfmsiy2kAJ+ozKUi9BlnLRtCMnnxRH2GEV6w6t2C4WjWi/IBYr+YUn5veiZtAyQYG/NYgZhCM6yqvfIpfog2wPC3cc0tXj2oehZo8OXj8YvCbz3i8LR+wXn6lNewitJiYNX0yOVzCAWH6xd0QFlNULTk3RYNarM/a5ZmRXil35fhGWsDJnGWjNC5r32WXJB9eAZANpoNMiX/dbUxZTLWqolRGqC3M+JH3qjl/Cy/JSu+pWbSN/mtl/RzLD6W2fZBRtbApHTT+BoRi+x4hz/W6kl5FVUvl3NiSAiZsFQ4DoQ==', 'SigningCertUrl': 'https://sns.us-west-1.amazonaws.com/SimpleNotificationService-7ff5318490ec183fbaddaa2a969abfda.pem', 'UnsubscribeUrl': 'https://sns.us-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-1:12345678765:topic_name:c765a5cf-06cf-44d8-afdc-28b63033c949', 'MessageAttributes': {}}} ``` ``` {'EventSource': 'aws:sns', 'EventVersion': '1.0', 'EventSubscriptionArn': 'arn:aws:sns:us-west-1:12345678765:topic_name:c765a5cf-06cf-44d8-afdc-28b63033c949', 'Sns': {'Type': 'Notification', 'MessageId': '39179993-647d-521d-ab77-c3a7a853b700', 'TopicArn': 'arn:aws:sns:us-west-1:12345678765:topic_name', 'Subject': 'Amazon SES Email Event Notification', 'Message': '{"eventType":"Open","mail":{"timestamp":"2021-12-16T03:10:32.670Z","source":"redact","sendingAccountId":"12345678765","messageId":"0111017dc1384ede-364355c2-5014-4940-a863-a811402771c1-000000","destination":["destination@gmail.com"],"headersTruncated":false,"headers":[{"name":"Date","value":"Thu, 16 Dec 2021 03:10:32 +0000"},{"name":"From","value":"redact"},{"name":"Reply-To","value":"redact"},{"name":"To","value":"destination@gmail.com"},{"name":"Message-ID","value":"<240748958.52874.1639624232756@ip-10-0-99-60.us-west-1.compute.internal>"},{"name":"Subject","value":"subject line"},{"name":"MIME-Version","value":"1.0"},{"name":"Content-Type","value":"text/html; charset=UTF-8"},{"name":"Content-Transfer-Encoding","value":"quoted-printable"}],"commonHeaders":{"from":["redact"],"replyTo":["redact"],"date":"Thu, 16 Dec 2021 03:10:32 +0000","to":["destination@gmail.com"],"messageId":"0111017dc1384ede-364355c2-5014-4940-a863-a811402771c1-000000","subject":"subject line"},"tags":{"ses:operation":["SendTemplatedEmail"],"ses:configuration-set":["topic_name"],"ses:source-ip":["redact"],"ses:from-domain":["b.com"],"ses:caller-identity":["caller_id"]}},"open":{"timestamp":"2021-12-16T05:09:02.441Z","userAgent":"Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)","ipAddress":"0.0.0.219"}}\n', 'Timestamp': '2021-12-16T05:09:02.489Z', 'SignatureVersion': '1', 'Signature': 'VUVBiM+AiCrfdjhZROCI2C3CnYiHD0fa/l8JK5adqnwTXauCZ83Ee/TFZXTXlXk9kweErI5n7ogbHDfe7nvTCjUuQ89I7WM1otU1xW7jkgxInSRTB4QrZl9FFhRUXQ5YiAlYJzhx3gB8+lD46hcQ2vGpRZ8IMPIpo7cnmryeBJxDHJg6ulQL+KWllrJVe8FHWjB5PeCxBHSl3+KWdmjVpakkF45pOpURXhuhVLtgUIP81AUM1510WtJhgKGvc1k1upUrLGHfWnsWe/qRCq+FJ4TdPvbokyGX/TahaSiBQYfgW9GhhRDWTjz5ebYdV9DZeIaJ7zPm0ep+2BYuHhYt4Q==', 'SigningCertUrl': 'https://sns.us-west-1.amazonaws.com/SimpleNotificationService-7ff5318490ec183fbaddaa2a969abfda.pem', 'UnsubscribeUrl': 'https://sns.us-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-1:12345678765:topic_name:c765a5cf-06cf-44d8-afdc-28b63033c949', 'MessageAttributes': {}}} ``` Anyone have any clue what I'm doing wrong to cause this?
1
answers
0
votes
4
views
AWS-User-1001564
asked a month ago

Not able to send sms(Text messages) through api to USA region using csharp dotnet

We are actually trying to send sms(text messages) to US destination{.AmazonSimpleNotificationServiceClient}. from oregon region (Us west-2), in api call its showing successful but in aws console it shows failed. But we are able to send sms to mobile form mumbai region (APSouth) region using same api service. so all i got to know is we need an Origination ID to send sms txt messages to US destination. while requesting in excess limit it show only 10dlc option but not short codes. So even while creating an origination ID also i am facing issue. I have increased the usage limit in oregon region also. Below is the code i am using in api AmazonSimpleNotificationServiceClient snsClient = new AmazonSimpleNotificationServiceClient("access key", "secret key", Amazon.RegionEndpoint.USWest2); PublishRequest pubRequest = new PublishRequest(); // pubRequest.Message = message+ " is the OTP for your multi factor authentication.This code will expire in 10 minutes."; pubRequest.Message = message; pubRequest.PhoneNumber = mobileNo; // add optional MessageAttributes, for example: ////pubRequest.MessageAttributes.Add("AWS.SNS.SMS.SenderID", new MessageAttributeValue ////{ StringValue = "clicinsight", DataType = "String" }); // pubRequest.MessageAttributes AWS.SNS.SMS.SenderID"] = new MessageAttributeValue { StringValue = "...", DataType = "String" }; //pubRequest.MessageAttributes AWS.SNS.SMS.MaxPrice"] = // new MessageAttributeValue { StringValue = "0.50", DataType = "Number" }; pubRequest.MessageAttributes AWS.SNS.SMS.SMSType"] = new MessageAttributeValue { StringValue = "Transactional", DataType = "String" }; PublishResponse pubResponse = snsClient.Publish(pubRequest);
1
answers
0
votes
8
views
vivek
asked a month ago

AWS Pinpoint/SNS: Two-way SMS unsubscribe/resubscribe implementation

I'm facing some issues while implementing Two-way SMS unsubscribe/resubscribe using AWS Pinpoint and SNS. Use Case: After collecting the user's number, he gets a confirmation SMS. He replies with the YES keyword to opt into the SMS list. He may later opt out by replying with the STOP keyword. After opting out, he still has the option to resubscribe by replying with the START keyword. Furthermore, even after resubscribing, he has an option to unsubscribe again by replying with the STOP keyword, and so on. Current Implementation: Similar to the example given in the documentation (https://docs.aws.amazon.com/pinpoint/latest/developerguide/tutorials-two-way-sms.html), I have a lambda function subscribed to the SNS topic which handles the YES and START keywords. Responses to STOP (and HELP) keyword(s) are handled by AWS Pinpoint. 1. After collecting the user's number, the backend creates a pinpoint endpoint for the user's number, sends him the confirmation SMS, and updates the endpoint opt-out status to ALL. 2. User replies with YES, his reply is handled by the lambda which updates the endpoint opt-out status to NONE. 3. User replies with STOP, his reply is handled by pinpoint, which automatically opts him out. 4. User replies with START, his reply is handled by the lambda which updates the endpoint opt-out status to NONE. I need help with the following queries: 1. In step 3 of the above implementation, I've noticed that the user's number gets added to the SNS opt-out list (as checked from AWS Console), but his pinpoint endpoint opt-out status (as checked from aws-cli) is still set to NONE instead of ALL. As expected, I am unable to send SMS to this user. Are there two separate opt-out statuses maintained for pinpoint and SNS as I've observed? If yes, is there in-depth documentation regarding how they get updated? 2. In step 4 of the above implementation, I've noticed that the user's number does NOT get removed from the SNS opt-out list and his pinpoint endpoint opt-out status remains NONE. Unlike the expected behavior, I am still unable to send SMS to this user. Am I doing the resubscribe implementation correctly? Please answer the queries and guide me on the correct implementation of my use-case.
2
answers
0
votes
2
views
sagar-bs
asked a year ago
  • 1
  • 90 / page