I am running n8n on railway.app. Facing an issue with Mailjet integration.
I am trying to trigger a Template Email. Email sending is working. But the variables are not being rendered. I dont know if I am doing it right. Here is my node config screenshot.
The variable names are correct. Mailjet doesnt give insights to what went wrong or what the API payload was. I am guessing, it is a problem with how the payload is structured. Can correctly say only if there was some way to inspect the n8n request.
This is how Mailjet needs the requesust.
# This call sends a message to the given recipient with vars and custom vars.
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3.1/send \
-H 'Content-Type: application/json' \
-d '{
"Messages":[
{
"From": {
"Email": "[email protected]",
"Name": "Zarnik Accounts"
},
"To": [
{
"Email": "[email protected]",
"Name": "passenger 1"
}
],
"TemplateID": 5033095,
"TemplateLanguage": true,
"Subject": "Monthly Statement",
"Variables": {
"email_title": "",
"customer_name": "Valued Customer",
"closing_balance": ""
}
}
]
}'
Hi John, Just now I recieved a response from the mailjet team.
They said, all the variables are being received by mailjet properly intact. The reason why the email is being blocked is that there was a missing variable.
Let me look into that, and give you an update here. Thanks for your time.
That is handy to know, Would be great if the MailJet API returned that something was missing if it is needed but there could be something in the API for that already I will take a look.