sms using aws sns

without a origination number messages look like this

https://docs.aws.amazon.com/pinpoint/latest/userguide/settings-sms-request-number.html


make sure to choose transactional. Messages get sent immediately with no fail rate.

Requests for long codes and toll-free numbers are usually approved immediately. If your request is approved, you can access your new phone numbers on the Phone numbers tab of the SMS and voice settings page.

after sending out message with new number, this is how it looks

This feature allows you to receive and process messages. You can define keywords for messages that you want to receive and process outside of Amazon Pinpoint. When your number receives an SMS message that begins with one of these keywords, Amazon Pinpoint sends the message and related data to an Amazon SNS topic in your account. You can use Amazon SNS to publish the message to topic subscribers, or to AWS services for further processing.

Aws pinpoint

Sns topic

An Amazon SNS topic is a logical access point that acts as a communication channel. A topic lets you group multiple endpoints (such as AWS Lambda, Amazon SQS, HTTP/S, or an email address).

Basically if you you can direct sns to send a specific message through all subscriptions in the topic.

If i send a message through sns using this topic, aww*** will receive an email and the 646*** will receive a text.

Subscriptions

these endpoints are hit when this topic is replied back to. so when you send a message to someone and they reply these endpoints get hit. you can also do a http or https endpoint. Below is a message of someone saying “hey”

this is called a payload. to avoid the reply getting sent back this way. you have to create a http end point get the message from the json object then send it again through sns api.

When you subscribe an HTTP endpoint, Amazon SNS sends it a subscription confirmation request. Your endpoint must be prepared to receive and process this request when you create the subscription because Amazon SNS sends this request at that time.

Aws subscription confirmation for https endpoint

Your code should read the HTTP headers of the HTTP POST requests that Amazon SNS sends to your endpoint. Your code should look for the header fieldĀ x-amz-sns-message-type, which tells you the type of message that Amazon SNS has sent to you

https://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.prepare.html

Your code should parse the JSON document in the body of the HTTP POST, read the value for SubscribeURL and visit that URL


Leave a Reply

Your email address will not be published.