Generating dynamic URL based on a contact property


#1

I'm trying to figure out a way to generate a dynamic URL based on a contact property.

Here is the use case:

  1. User signs up for a free trial via a HubSpot form
  2. We send them an email with a link to activate their account
  3. Clicking on this sends a webhook out to generate a "magic link" which is then pushed back to their HubSpot contact record
  4. The email takes them to a landing page and the goal of the landing page is to have that dynamically generated unique link on the page which will activate their account.

The part I'm stuck on is how to query their contact record to pull the URL and dynamically insert it into the landing page.


#2

Hi @Dustin,

Just to make sure that we're on the same page, I have a few questions:

  1. When the contact arrives on the landing page, there should be a dynamically generated link?
  2. What are the requirements for this custom link?
  3. Is there a reason this link needs to be stored in a contact property?
  4. Is the final landing page hosted on HubSpot?

#3

Thanks for the reply Derek!

  1. Yes, we will need a bit of a time delay though but we can easily build in a spinner and make a call to the API to see if the field is populated.
  2. It's generated by our platform and is basically a unique login link.
  3. No, we just figured that would be the easiest place to store it and link it to the contact.
  4. Yes, it is.

#4

Hi @Dustin,

I understand; thanks for the clarification! So if the final landing page is hosted on HubSpot, and the link is stored in a contact property, you can simply include it on the landing page by using a personalization token and perhaps some smart content. The only tricky part would be making sure that the visitor coming to your site has that property populated.

When exactly is this link created / added to the contact record? If this happens on the form submission, then you can easily just direct the visitor to the landing page and be confident that the contact property will be populated by the time they get the email / click the link / reach the landing page.

If instead the link is created when a contact clicks into the email, you'll need to introduce a time delay of a few seconds to be confident that the contact property will be populated when the visitor reaches the landing page. Does the link in the email direct visitors to an external page? If so, you could potentially use the 'Get contact by usertoken' endpoint to check if that particular property exists. Does that make sense? Is that inline with what you were thinking?


#5

Hi @Derek_Gervais,

I found this thread looking for whether it's possible to embed an activation link from an external system into a HubSpot email.

We have a custom CRM which auto generates an activation link, but we want to send the email with the activation link from within HubSpot. On that basis we have the following questions:

  • Is it as simple as just syncing this data with a custom field in HubSpot?
  • If so, are there any requirements around that field? How would this work?
  • If it's a custom field, presumably we just add a personalisation token into the email to add the activation link, as you have mentioned above?
  • Will we need the transactional email add-on to do this?
  • Are there any other things we should be aware of in terms of ensuring the activation link works - currently it is a 1-time use link and is custom generated per contact?

Thanks in advance for your help!


#6

Hi @JessicaPacker,

If you're creating the activation link entirely outside of HubSpot, you're correct that you should be able to just push that into a custom contact property and use it via a personalization token in an email. I'll try to quickly address the specific questions you asked:

  • Yes
  • No; it could just be a text field
  • Yes
  • No; but you could do this with the transactional email add on as well
  • I can't think of anything specific; putting links in contact properties, then including them in emails via personalization tokens is generally pretty straightforward.

Let me know if you have any other questions!


#7

Hi @Derek_Gervais ,

My use-case is the same as Jessica's, and we have successfully inserted dynamic links into emails, where those links are stored as Contact Properties and pushed from an external system.

The question I have is how to embed the link behind text. Pulling it in as a dynamic text field, we are able drop the bare link into an email, but would like to embed it behind text such as "click this link here". Does that make sense?

thanks,
Todd


#8

Hi @Todd_Detmold,

Personalization tokens should still work in hyperlinks. You could do something like this:

<a href="{{ contact.link }}">Click here!</a>