Generating dynamic URL based on a contact property

SOLVE
Occasional Contributor

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.

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

Welcome, @allison.c!

I'll respond in this thread of yours.

Isaac Takushi

HubSpot Developer Support
11 Replies 11
Community Manager

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?
Reply
0 Upvotes
Highlighted
Occasional Contributor

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.
Reply
0 Upvotes
Community Manager

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?

Reply
0 Upvotes
New Member

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!

Reply
0 Upvotes
Community Manager

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!

Reply
0 Upvotes
New Member

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

Reply
0 Upvotes
Community Manager

Hi @Todd_Detmold,

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

<a href="{{ contact.link }}">Click here!</a>
Reply
0 Upvotes
Top Contributor

Hello @Derek_Gervais

i'm really hoping someone can help me here. I had the same issue as mentioned in this thread....
I want to send a custom url to our contacts.
I created a workflow that sent an email triggered on custom url being known and the contact owner being X. This workflow then triggered an automatic email to the contact with a custom url link - great!
But my issue is, if we update or create a new custom url for the contact, how do i re-enroll them into this same workflow. Or how do I send them another email from contact owner X with their new custom url.
The custom url is generated automatically from an external source.

I tired to add "clear property value" for custom url property to the end of the workflow so that would remove them and then when i new url was added to the property the workflow would be triggered again. BUT this then just deleted the custom url link from the email too :frowning:

Any help much appreciated.
Allison

Reply
0 Upvotes
HubSpot Moderator

Welcome, @allison.c!

I'll respond in this thread of yours.

Isaac Takushi

HubSpot Developer Support
Top Contributor

Hi @Isaac_Takushi,

I think I've managed to fix this. The clear property has worked - it didn't delete it from them email as I had initially thought. I just need to do more testing to make sure contacts can still re-enroll into this same workflow....

Thanks
Allison

Reply
0 Upvotes
HubSpot Moderator

Glad to hear it, @allison.c!

If something does come up in your testing, let's continue the conversation in this thread.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes