Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package org.lightside.notification;
import java.util.HashMap;
import java.util.Map;
import org.lightside.main.AwsClientFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SmsNotificationService {
private static final Logger LOG = LoggerFactory.getLogger(SmsNotificationService.class);
public PublishResult send(String phoneNumber, String message) {
Map<String, MessageAttributeValue> smsAttributes = new HashMap<String, MessageAttributeValue>();
smsAttributes.put("AWS.SNS.SMS.SenderID", new MessageAttributeValue()
.withStringValue("Lightside") //The sender ID shown on the device (except in US)
smsAttributes.put("AWS.SNS.SMS.MaxPrice", new MessageAttributeValue()
.withStringValue("0.01") //Sets the max price to 0.01 USD.
smsAttributes.put("AWS.SNS.SMS.SMSType", new MessageAttributeValue()
.withStringValue("Promotional") //Sets the type to promotional.
PublishResult result = AwsClientFactory.getSnsClient().publish(new PublishRequest()
.withMessageAttributes(smsAttributes));"Sent SMS message ID: " + result.getMessageId());
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment