A user will create an account on my web app. The app will need to authenticate the user by sending a text message to the mobile phone number that the user provides. The text m
Some methods have been deprecated in AWS SDK.
BasicAWSCredentials awsCredentials = new BasicAWSCredentials("CLIENT-ID", "SECRET-KEY");
AmazonSNS snsClient = AmazonSNSClientBuilder.standard()
.withRegion(Regions.fromName("YOUR_REGION"))
.withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build();
Map smsAttributes = new HashMap();
smsAttributes.put("AWS.SNS.SMS.SenderID",new MessageAttributeValue().withStringValue("SENDER-ID").withDataType("String");
smsAttributes.put("AWS.SNS.SMS.SMSType",new MessageAttributeValue().withStringValue("Transactional").withDataType("String"));
PublishRequest request = new PublishRequest();
request.withMessage("YOUR MESSAGE")
.withPhoneNumber("E.164-PhoneNumber")
.withMessageAttributes(smsAttributes);
PublishResult result=snsClient.publish(request);