I am a Salesforce developer, and recently I've been trying to integrate the AWS SES Api into my project. I have run into many issues along the way (you can follow here)
I have successfully managed to post to AWS SES and get emails sent however, when I try to send a request using the Templated email method I run into an issue.
JSON body
{
"Content": {
"Template": {
"TemplateData": "{\"unsubscribe\":\"test\"}",
"TemplateName": "Welcome_Email"
}
},
"Destination": {
"ToAddresses": [
"<redacted email address>"
]
},
"FromEmailAddress": "<redacted email address>",
"ReplyToAddresses": [
"<redacted email address>"
]
}
When I send the request using this Body it responds with a Status 400 with a body of {"Message":null}
When I send an Email using the Simple method, it's successful and send the email
{
"Content": {
"Simple": {
"Body": {
"Html": {
"Charset": "UTF-8",
"Data": "Test"
}
},
"Subject": {
"Charset": "UTF-8",
"Data": "Test"
}
}
},
"Destination": {
"ToAddresses": [
"<redacted email address>"
]
},
"FromEmailAddress": "<redacted email address>",
"ReplyToAddresses": [
"<redacted email address>"
]
}
Right now I am just going to create the html data and use the simple method but I would like to be able to use templates in the future.
Any help would be appreciated.
UPDATE:
Figured out the formatting of my JSON was wrong here
Incorrect:
"TemplateData": "{\"unsubscribe\":\"test\"}"
Correct:
"TemplateData": "{unsubscribe:test}"