use of com.amazonaws.services.pinpoint.model.AddressConfiguration in project aws-doc-sdk-examples by awsdocs.
the class SendMessage method main.
public static void main(String[] args) throws IOException {
try {
Map<String, AddressConfiguration> addressMap = new HashMap<String, AddressConfiguration>();
addressMap.put(destinationNumber, new AddressConfiguration().withChannelType(ChannelType.SMS));
AmazonPinpoint client = AmazonPinpointClientBuilder.standard().withRegion(region).build();
SendMessagesRequest request = new SendMessagesRequest().withApplicationId(appId).withMessageRequest(new MessageRequest().withAddresses(addressMap).withMessageConfiguration(new DirectMessageConfiguration().withSMSMessage(new SMSMessage().withBody(message).withMessageType(messageType).withOriginationNumber(originationNumber).withSenderId(senderId).withKeyword(registeredKeyword))));
System.out.println("Sending message...");
client.sendMessages(request);
System.out.println("Message sent!");
} catch (Exception ex) {
System.out.println("The message wasn't sent. Error message: " + ex.getMessage());
}
}
use of com.amazonaws.services.pinpoint.model.AddressConfiguration in project aws-doc-sdk-examples by awsdocs.
the class SendMessages method main.
public static void main(String[] args) throws IOException {
try {
Map<String, AddressConfiguration> addressMap = new HashMap<String, AddressConfiguration>();
addressMap.put(toAddress, new AddressConfiguration().withChannelType(ChannelType.EMAIL));
AmazonPinpoint client = AmazonPinpointClientBuilder.standard().withRegion(region).build();
SendMessagesRequest request = (new SendMessagesRequest().withApplicationId(appId).withMessageRequest(new MessageRequest().withAddresses(addressMap).withMessageConfiguration(new DirectMessageConfiguration().withEmailMessage(new EmailMessage().withSimpleEmail(new SimpleEmail().withHtmlPart(new SimpleEmailPart().withCharset(charset).withData(htmlBody)).withTextPart(new SimpleEmailPart().withCharset(charset).withData(textBody)).withSubject(new SimpleEmailPart().withCharset(charset).withData(subject)))))));
System.out.println("Sending message...");
client.sendMessages(request);
System.out.println("Message sent!");
} catch (Exception ex) {
System.out.println("The message wasn't sent. Error message: " + ex.getMessage());
}
}
Aggregations