1

I am trying to add a unique link to a sendgrid template, but so far I have had no luck. The button in the sendgrid is the following:

<a href="-org_url-" target="_blank">Accept</a>

I have also tried:

 <a href="{{org_url}}" target="_blank">Accept</a>

My javascript function looks like this:

const msg = {
        to: process.env.EMAIL_TO,
        from: process.env.EMAIL_FROM,
        templateId: process.env.SENDGRID_TEMPLATE_ID,
        dynamic_template_data: {
            org_url: `${process.env.ORG_URL}/${key}`,
        },
        substitutions: {
            '-org_url-': `${process.env.ORG_URL}/${key}`
        }
    };

Upon checking the sent email, the href field is either empty or only has -org_url- in it. How could I pass it the proper link? Thank you!

Jani
  • 507
  • 3
  • 21

2 Answers2

1

You can edit module html code and use string interpolation to insert the handlebar.

<a href=`{{shipperLoadUrl}}`>portal</a>
Dax Wann
  • 11
  • 2
0

Assuming that you're using SendGrid's v3 API (which you are if you're using their Library), you need to make sure to pass the Substitution argument within the Personalization argument.

If you're not using the Library and are hand-building your call, you'll need to follow the full format, or implement the Library.

jacobmovingfwd
  • 2,185
  • 14
  • 11