N
Novu•9mo ago
Erez

Can I build my email template in Sendgrid and trigger it via Novu?

Also how can I pass on variables to be used in the email template within Sendgrid?
7 Replies
Pawan Jain
Pawan Jain•9mo ago
Hi Erez 👋 Currently we don't support the template import from email provider feature You will need to copy the html content from template and paste into email code editor We use handlebars variables https://docs.novu.co/content-creation-design/handlebars-helpers Hi @erez0573 We have found a solution to use sendgrid templates from novu itself. i will keep you posted about this
Erez
Erez•9mo ago
@Pawan Jain any updates?
Pawan Jain
Pawan Jain•9mo ago
Hi @Erez PR is up https://github.com/novuhq/novu/pull/4209 I am hoping to be included this in 0.20.0 that is going to release tomorrow
Erez
Erez•8mo ago
Hi, Is it now available?
Pawan Jain
Pawan Jain•8mo ago
Hi @Erez We could not deploy 0.20.0 last week due to broken pipeline and npm version publishing issue. We are working on resolving this issue.
Erez
Erez•8mo ago
@Pawan Jain any updates?
Pawan Jain
Pawan Jain•8mo ago
Hi @Erez We have released 0.20.0 version and support of sending customData in email overrides. However a minor bug fix is pending. Apologies from my side for taking this so long https://github.com/novuhq/novu/pull/4504 If you use our api to trigger the workflow then it will work, but if you are using nodejs sdk, above PR will fix the bug An example curl using our api
curl --location 'https://api.novu.co/v1/events/trigger' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: ApiKey <API_KEY>' \
--data-raw '{
"name": "workflow-trigger-identifier",
"to": "subscriberId",
"payload": {
"payloadVariableKey": "payloadVariableValue"
},
"overrides": {
"email": {
"customData": {
// sendgrid template templateId
"templateId": "d-d965b02b1b5d4856bf332a5e98c7470c",
// sendgrid template variables
"dynamicTemplateData": {
"total": "$ 239.85",
"items": [
{
"text": "New Line Sneakers",
"image": "https://marketing-image-production.s3.amazonaws.com/uploads/8dda1131320a6d978b515cc04ed479df259a458d5d45d58b6b381cae0bf9588113e80ef912f69e8c4cc1ef1a0297e8eefdb7b270064cc046b79a44e21b811802.png",
"price": "$ 79.95"
},
{
"text": "Old Line Sneakers rlfjrjrh4hr4rh4",
"image": "https://marketing-image-production.s3.amazonaws.com/uploads/3629f54390ead663d4eb7c53702e492de63299d7c5f7239efdc693b09b9b28c82c924225dcd8dcb65732d5ca7b7b753c5f17e056405bbd4596e4e63a96ae5018.png",
"price": "$ 79.95"
}
],
"receipt": true,
"name": "Sample Name",
"address01": "1234 Fake St.",
"address02": "Apt. 123",
"city": "Place",
"state": "CO",
"zip": "80202"
}
}
}
}
}'
curl --location 'https://api.novu.co/v1/events/trigger' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: ApiKey <API_KEY>' \
--data-raw '{
"name": "workflow-trigger-identifier",
"to": "subscriberId",
"payload": {
"payloadVariableKey": "payloadVariableValue"
},
"overrides": {
"email": {
"customData": {
// sendgrid template templateId
"templateId": "d-d965b02b1b5d4856bf332a5e98c7470c",
// sendgrid template variables
"dynamicTemplateData": {
"total": "$ 239.85",
"items": [
{
"text": "New Line Sneakers",
"image": "https://marketing-image-production.s3.amazonaws.com/uploads/8dda1131320a6d978b515cc04ed479df259a458d5d45d58b6b381cae0bf9588113e80ef912f69e8c4cc1ef1a0297e8eefdb7b270064cc046b79a44e21b811802.png",
"price": "$ 79.95"
},
{
"text": "Old Line Sneakers rlfjrjrh4hr4rh4",
"image": "https://marketing-image-production.s3.amazonaws.com/uploads/3629f54390ead663d4eb7c53702e492de63299d7c5f7239efdc693b09b9b28c82c924225dcd8dcb65732d5ca7b7b753c5f17e056405bbd4596e4e63a96ae5018.png",
"price": "$ 79.95"
}
],
"receipt": true,
"name": "Sample Name",
"address01": "1234 Fake St.",
"address02": "Apt. 123",
"city": "Place",
"state": "CO",
"zip": "80202"
}
}
}
}
}'
Make sure your sendgrid api key have access of reading template
Want results from more Discord servers?
Add your server
More Posts