Amazon Simple Notification Service (SNS) via SMS

Anurag Dhunna
Viithiisys
Published in
2 min readAug 16, 2017

In today’s world, Notification has become a key to grow a business. SMS notification are used by each and every successful company as it plays a important role in creating a relationship between a company and a customer.

I will show how you can integrate Amazon Simple Notification Service (SNS) via SMS for a particular customer and for specific group of customers.

We will begin with sending sms to a particular customer(number) at a time.

For this you all you need to have AMAZON SNS account credentials.

Add Dependencies

Maven:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.10.74</version>
</dependency>

Gradle:

compile group: ‘com.amazonaws’, name: ‘aws-java-sdk’, version:1.10.74

Send SMS to Single Phone Number via Amazon SNS

Executing the main method will send SMS to your desired Phone Number.

NOTE: Phone Number should not have DND Service activated.

This method was only for sending a particular message to a particular customer but for sending same message to number of customers we can send subscription based sms.

Steps:

  • Create Topic: We will create a SMS Topic to which phone numbers will be subscribed.
  • Subscribe: Subscribe Phone Numbers to that SMS Topic.
  • Publish: After subscribing phone numbers to topic publish the message to the topic. The sms will be sent to all the subscribed phone numbers.
Send SMS to Multiple Phone Number via Amazon SNS

Executing this class will send sms to all the subscribed customers.

There number of notification that we want to send at a specific time like end of subscription for a product, etc. To resolve these kind of schedule problems I will share steps to Schedule these sms using Quartz Scheduler in my next post.

If you want me to elaborate on anything or have any questions, feel free to leave me a note or email me anurag.dhunna@gmail.com .

--

--

Anurag Dhunna
Viithiisys

Android, Java Software Developer. I write about technologies that I used in the journey of programming. Email: anurag.dhunna@gmail.com