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

1 messages · Page 1 of 1 (latest)

tidal umbra
obtuse sandBOT
#

Hi @tidal umbra, 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.

#

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"
});

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

obtuse sandBOT
autumn crystal
#

@tidal umbra 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