N
Novu2mo ago
San

Can we use Dynamic templates of Send grid using Golang package of Novu?

We are currently using sendgrid provider for emails And we are using sendgrid dynamic templates to send emails Does golang package of novu supports this? https://docs.novu.co/channels-and-providers/email/sendgrid
Novu
SendGrid - Novu
Learn how to use the Sendgrid provider to send email notifications using Novu
5 Replies
Ask Inkeep
Ask Inkeep2mo ago
Hi @San, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question. ----------------------------- While I generate an answer, here are some sources that might be helpful: * SendGrid * Glossary * NextJS * Email -----------------------------
Ask Inkeep
Ask Inkeep2mo ago
Answer Yes, you can use SendGrid's dynamic templates with the Novu platform, including through the Golang package of Novu. While the specific Golang implementation details are not directly provided in the documentation, the general capability to utilize SendGrid dynamic templates via Novu is supported. This includes passing custom data necessary for dynamic templates through the Novu API, which can be implemented in any Novu API client, including Golang (1) . For a detailed example in Node.js, which can be adapted to Golang, you can refer to the documentation on how to integrate SendGrid dynamic templates by using the customData field in the email overrides during the API call. Here's an example provided in Node.js:
import { Novu } from '@novu/node';
const novu = new Novu('<NOVU_API_KEY>');
await novu.subscribers.trigger("workflowIdentifier", {
to: "subscriberId",
payload: {},
overrides: {
email: {
customData: {
templateId: 'sendgrid-template-id',
dynamicTemplateData: {
total: '$239.85',
items: [{
text: 'New Line Sneakers',
image: 'https://example.com/path/to/image.png',
price: '$79.95'
}]
}
}
}
},
actor: "actorId",
tenant: "tenantIdentifier"
});
import { Novu } from '@novu/node';
const novu = new Novu('<NOVU_API_KEY>');
await novu.subscribers.trigger("workflowIdentifier", {
to: "subscriberId",
payload: {},
overrides: {
email: {
customData: {
templateId: 'sendgrid-template-id',
dynamicTemplateData: {
total: '$239.85',
items: [{
text: 'New Line Sneakers',
image: 'https://example.com/path/to/image.png',
price: '$79.95'
}]
}
}
}
},
actor: "actorId",
tenant: "tenantIdentifier"
});
You would need to adapt a similar structure in your Golang application using the appropriate Novu Golang SDK methods. Make sure your API key has the necessary permissions to access SendGrid templates. For further details on setting up and using dynamic templates with SendGrid in Novu, you can check the provided documentation link.
Sources [1] SendGrid
Ask Inkeep
Ask Inkeep2mo ago
Got it. Tagging @Support for additional help.
Pawan Jain
Pawan Jain2mo ago
@San golang sdk is backend sdk. I see it has overrides options. so you will be able to send sendgrid specif fields similar to nodejs sdk example
San
San2mo ago
Yeah it's working