We've been able to create an unsubscribe link for any email sent using a transactional template but we've been unable to get the unsubscribe link to appear in the location we want using substitution tags. The unsubscribe links just appear at the bottom of the email.
Here's a list of tags we've tried:
[unsubscribe]
%unsubscribe%
<%unsubscribe%>
%asm_preferences_url%
<%asm_preferences_url%>
Here's a screenshot of how it's showing up:

Here's out code to send the email:
email = sendgrid.Mail(to=rep_email, from_email="[email protected]", from_name="Support")
email.add_filter('templates', 'enable', '1')
email.add_filter('templates', 'template_id', 'our-template-id')
email.add_substitution("$addon", addon)
email.add_substitution("$firstname", first_name)
email.add_substitution("$purchaseurl", purchase_link)
email.set_html(' ')
email.set_text(' ')
email.set_subject(' ')
email.set_asm_group_id(981)
sg.send(email)
Hello @mdavoodi,
Thanks for reaching out to us.
I believe the unsubscribe link is modified as described here: https://sendgrid.com/docs/Classroom/Track/Unsubscribes/unsubscribe_via_subscription_tracking.html
If you continue to have issues, please contact our support team at https://support.sendgrid.com
With Best Regards,
Elmer
@mdavoodi did you manage to do this? I'm having the same problem here and it won't be fixed with @thinkingserious's solution...
Hi @danielweinmann,
I suggest you reach out to our support team at https://support.sendgrid.com. They will be happy to help. Thanks!
@danielweinmann no, that didn't work the way I wanted it too. I ended up keeping the un-styled links at the bottom. If you figure out a better solution please let me know.
@mdavoodi and @thinkingserious , I ended up making it work with the<%asm_group_unsubscribe_raw_url%> and <%asm_preferences_raw_url%> tags.
The problem I was facing was happening because I switched from "CODE" to "DESIGN" before saving the template. When I did that, it changed the < and > for < and > and that change caused the problem.
When I did add the tags and saved the template while still in "CODE" mode, it worked :D
Thanks @danielweinmann!
That issue regarding the switch between "CODE" and "DESIGN" is a high priority fix.
o/
Ha, had to look that one up (highest of fives to you sir)
Most helpful comment
@mdavoodi and @thinkingserious , I ended up making it work with the
<%asm_group_unsubscribe_raw_url%>and<%asm_preferences_raw_url%>tags.The problem I was facing was happening because I switched from "CODE" to "DESIGN" before saving the template. When I did that, it changed the < and > for < and > and that change caused the problem.
When I did add the tags and saved the template while still in "CODE" mode, it worked :D