I am trying to send dynamic data from NodeJs in sendgrid web api email templates but unable to send.
It is showing something like this below in email where I want to show dynamic data:
" _
This is my node js code below:
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: req.body.email,
from: '[email protected]',
templateId:'d-8e322d7da4f44ca1afc76aefb3725555',
substitutionWrapppers:['{{" , "}}'],
substitutions:
{
company_name:'Example',
state:'Rajasthan'
}
sgMail.send(msg, (err) => {
if(err){
console.log("Error", err);
}else{
console.log("Email sent");
}
});
In send grid email template below:
{{company}} {{state}}
Someone please let me know what I am doing wrong.Any help would be appreciated.
THANKS