I am just getting started with Amazon Pinpoint and I am trying to use the AWS Java SDK to send a direct message to an endpoint that has an email address. I am certain that the endpoint ID exists and the email address has been verified.
Here is the response I am receiving:
{
SendUsersMessageResponse: {
ApplicationId: ab9efe03c5654594bd55aee0589d9a60,
Result: {
u777={
777={
Address: xxxxxxxx@abc.com,
DeliveryStatus: PERMANENT_FAILURE,
StatusCode: 400,
StatusMessage: Requestmustincludemessageemailmessage.,
}
}
}
}
}
Here is my source code:
DefaultMessage defaultMsg = new DefaultMessage()
.withBody("The body");
DirectMessageConfiguration directMsgConfig = new DirectMessageConfiguration()
.withDefaultMessage(defaultMsg);
Map<String, EndpointSendConfiguration> users = new HashMap<>();
users.put("u777", new EndpointSendConfiguration());
SendUsersMessageRequest msgReq = new SendUsersMessageRequest()
.withMessageConfiguration(directMsgConfig)
.withUsers(users);
SendUsersMessagesRequest msgsReq = new SendUsersMessagesRequest()
.withApplicationId(applicationID)
.withSendUsersMessageRequest(msgReq);
SendUsersMessagesResult msgsRes = client.sendUsersMessages(msgsReq);
I can see the error says I must include an email message, but looking through the documentation and developer guide I can not figure out what I need to do.
Thanks!