Best answer

SendGrid unsubscribe and manage preferences links not working in HTML email.

  • 8 August 2023
  • 20 replies
  • 1045 views

Userlevel 1

Hello all,

 

I am trying to trigger an email from sendgrid off the back of a google sheet. When trying to do this, I keep getting an error message to do with the unsubscribe and manage preferences links in the HTML. I can set it live, but links don’t work when I send it. I have tried simply writing out what it should be ({{{unsubscribe}}} and {{{unsubscribe_preferences}}}) but keep getting the same error. 

 

Does anybody know how to get around this?

 

 

icon

Best answer by SamB 24 November 2023, 13:44

View original

20 replies

Userlevel 7
Badge +14

Hi @MKGTravelNest 

Good question.

What is the encountered error? (screenshot)

Userlevel 1

Hi @Troy Tessalone , there’s no such error message as such. Simply shows what’s in the screenshot above. When I send these with the error left then the links don’t work in the emails.

Userlevel 7
Badge +14

@MKGTravelNest 

You can try hardcoding the desired links.

 

This indicates the mapped variable is invalid as it’s not from a previous Zap step.

 

 

Userlevel 1

@Troy Tessalone tried doing that but it then automatically switches back to this when I run a test. Pretty sure this is a bug with the Sendgrid integration. Or it might be that zapier only allows transactional emails to be sent via sendgrid that don’t contain unsubscribe links.

Userlevel 7
Badge +14

@MKGTravelNest 

We would need to see updated screenshots with how your SendGrid Zap step is configured with the hardcoded links for unsub.

Would be helpful to see a received emails as well to see how it renders for those links.

Did this ever get resolved? - Same issue here

Userlevel 7
Badge +14

@Ben8989 and @MKGTravelNest 

Here’s the issue:

Zapier uses the double bracket syntax for variables:

{{variable}}

 

SendGrid uses the tripe bracket syntax for variables:

{{{unsubscribe}}}

 

So the issue is when you include the SendGrid variable syntax, Zapier interprets the inner double brackets as a variable and converts it.

Then when the Zap action step runs, no value is passed, because the mapped variable is invalid.

This breaks what SendGrid expects to receive, which is the triple bracketed variable.

 

 

@Ben8989and @MKGTravelNest 

Here’s the issue:

Zapier uses the double bracket syntax for variables:

{{variable}}

 

SendGrid uses the tripe bracket syntax for variables:

{{{unsubscribe}}}

 

So the issue is when you include the SendGrid variable syntax, Zapier interprets the inner double brackets as a variable and converts it.

Then when the Zap action step runs, no value is passed, because the mapped variable is invalid.

This breaks what SendGrid expects to receive, which is the triple bracketed variable.

 

 

 

Hi, I have attempted to do this with 1, 2 and 3 brackets and the same thing happens each time. It does not seem to recognize the field 

Userlevel 7
Badge +14

@Ben8989

2 and 3 brackets will cause issues.

Is there any solution to passing the unsubscribe variable to Sendgrid? 

I am having the same issue. the {{{unsubscribe}}} and {{weblink}} variables in my HTML are being stripped out by Zapier and they do not work when my email gets sent through SendGrid. Has anyone found a workaround for this issue?

Userlevel 7
Badge +14

@jcervantes 

Try setting those in the SendGrid template itself?

@jcervantes

Try setting those in the SendGrid template itself?

I’m not following what you mean. The HTML was designed in Stripo and I am using the {{{unsubscribe}}} and {{weblink}} variables. I export the HTML from Stripo and put it into the Zap using the SendGrid integration. However when Zapier runs the zap and passes that HTML to SendGrid it is removing the variables so SendGrid is not substituting in the correct link.

Userlevel 7
Badge +11

Hi @MKGTravelNest@Ben8989 and @jcervantes. 👋

Sorry to hear of the troubles here! I’ve just been doing some digging and came across this help guide on the SendGrid website which references a different way to output those tags using <% and %> instead of {{{ and }}}. 
c2ca70268479170cd373f582ce3e4431.png
As it doesn’t involve using those {{{ }}} brackets I’m hoping that will help to get around the issue. 🤞

Can you try adding those to the relevant <a href> tags and see if that does the trick?

Hi @MKGTravelNest@Ben8989 and @jcervantes. 👋

Sorry to hear of the troubles here! I’ve just been doing some digging and came across this help guide on the SendGrid website which references a different way to output those tags using <% and %> instead of {{{ and }}}. 
c2ca70268479170cd373f582ce3e4431.png
As it doesn’t involve using those {{{ }}} brackets I’m hoping that will help to get around the issue. 🤞

Can you try adding those to the relevant <a href> tags and see if that does the trick?

 

Thanks for looking into this for me. I also came across this page and tried using those instead of the {{{unsubscribe}}} but they do not work. I think those are designed to be used with their API and not just placed in the HTML like the handlebar variable is. 

Userlevel 7
Badge +11

Apologies for the delay in a response here, @jcervantes!

I’m so sorry those other tags didn’t work as hoped. Hmm, in that case it may be best to reach out to our Support team to investigate further as this may be the result of a bug. In which case they’ll be able to get a bug report opened for this issue so the app’s developers can get it sorted.

Please do keep us in the loop on how you get on with them. Would love to know if you’re able to find a workaround or temporary solution in the meantime! 🙂

Userlevel 1

Any solution to this? 

Userlevel 7
Badge +11

Hi @Mikee999! 👋

I took a look and it looks as though Support have added @jcervantes to a feature request to allow Email Templates to be used when using SendGrid’s Send Email action. Which in would allow you to use variables (though likely not including the “{{“ “}}” curly brackets) in your SendGrid Zaps. 

I’ve gone ahead and added votes for everyone here that has expressed an interest in using those variables. I can’t provide an ETA on when or if it will definitely be implemented but we’ll be sure to notify you all as soon as it is!

Userlevel 1

I found a solution :-)

1) Replacing {{{unsubscribe}}} with [unsubscribe] in the code.
2) Enabel Subscription Tracking in Sendgrid. Follow this guide. 
https://dgorski.medium.com/setup-unsubscribe-with-sendgrid-api-dynamic-templates-3b942d325d3d

 

Userlevel 7
Badge +11

YAY! That’s amazing news, @Mikee999! 🎉

Thanks so much for hopping back in here to share details of the solution you found - it’s very much appreciated! Hopefully it will work for everyone else in the thread here too! 😁🤞

Reply