Adding encrypted string to URL in email template

contacts

#1

Hi, I have a requirement where I need to have a link in an email template that has an encrypted redirect uri as a url parameter. The URL needs to be encrypted by our external system. The idea is that, when the link is clicked (which will point to one of our external endpoints), we can capture the click event, and then redirect to the specified url. The problem is, I’m having trouble figuring out how we can do this without calling an API on our side to encrypt the redirect url every time the template is called. I’m not even sure if an external API can be called from within a template.

Any help would be greatly appreciated


#2

Hi @j.miles

Is this something that needs to be set individually for each contact? Or is it something that would be set in the email template for all recipients of the email? There wouldn’t be a way to have the email make an outgoing call when being rendered for a contact, but you could use a custom contact property and store the URL in that property for the contacts that will get the email, then use a personalization token for that property in the email itself.

If it can be set in the template, you could update the template directly through the API.
https://developers.hubspot.com/docs/methods/templates/put_templates_template_id


#3

The redirect would be specific to a campaign, so it might be difficult for our system to know which redirect to update the template with without some chatter back and forth between the systems. It may just be an issue of us needing to rethink our usecase around what HubSpot offers.