- AWS Code Sample

/* Copyright, Inc. or its affiliates. All Rights Reserved. This file is licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.example.handlingformsubmission; import; import; import; import; import; import; import org.springframework.stereotype.Component; @Component("PublishTextSMS") public class PublishTextSMS { public void sendMessage(String id) { Region region = Region.US_EAST_1; SnsClient snsClient = SnsClient.builder() .region(region) .credentialsProvider(EnvironmentVariableCredentialsProvider.create()) .build(); String message = "A new item with ID value "+ id +" was added to the DynamoDB table"; String phoneNumber="ENTER MOBILE NUMBER"; //Replace with a mobile phone number try { PublishRequest request = PublishRequest.builder() .message(message) .phoneNumber(phoneNumber) .build(); PublishResponse result = snsClient.publish(request); } catch (SnsException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } }