APIs & Integrations

Jun22
Participant

Dynamic Pages Using CRM Objects

SOLVE

image.png

Hello Folks, 


I have Deals item listed on a page right now,  What I need if its possible when each deal item being clicked it will redirected to a page . Anyone here has something done similar to mine how can we achieve clicking those each item and retrieved data from the deal being clicked ? 🙏   

Below image is the individual deal based on ID . What if we get that company name and address etc. on a cms page dynamically based on the deal clicked on the item above. Thanks! 

Jun22_0-1672739121905.png

 

0 Upvotes
1 Accepted solution
Syeda_Fatima
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Dynamic Pages Using CRM Objects

SOLVE

Hi @Jun22, You could use HubSpot's JavaScript API to capture the click events from the deals and then build out a URL for the page you'd like the user to be redirected to.

In order to do this, you'll need to make a request to the Deals API to get the deal object associated with the deal item being clicked by the user. Once you have the deal object, you can use the deal properties to build a URL for the page you'd like to redirect the user to.

For more information about HubSpot's JavaScript API, please do refer to this suggested doc based on HubSpot's Developer: https://developers.hubspot.com/docs/api/overview

And Yes, the company name and address is possible with HubSpot CMS.
Hub
Spot CMS allows you to dynamically pull in content from other sources, including CRM data. You can use the HubSpot CRM API to fetch deal information and display it on a CMS page. You can use the HubSpot CMS HubL language to create dynamic pages that pull in the data from the API.

You can also use the HubSpot CMS to populate the page with the relevant data for each contact.

Let me know if more clarification is needed. Cheers!

View solution in original post

4 Replies 4
Syeda_Fatima
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Dynamic Pages Using CRM Objects

SOLVE

Hi @Jun22, You could use HubSpot's JavaScript API to capture the click events from the deals and then build out a URL for the page you'd like the user to be redirected to.

In order to do this, you'll need to make a request to the Deals API to get the deal object associated with the deal item being clicked by the user. Once you have the deal object, you can use the deal properties to build a URL for the page you'd like to redirect the user to.

For more information about HubSpot's JavaScript API, please do refer to this suggested doc based on HubSpot's Developer: https://developers.hubspot.com/docs/api/overview

And Yes, the company name and address is possible with HubSpot CMS.
Hub
Spot CMS allows you to dynamically pull in content from other sources, including CRM data. You can use the HubSpot CRM API to fetch deal information and display it on a CMS page. You can use the HubSpot CMS HubL language to create dynamic pages that pull in the data from the API.

You can also use the HubSpot CMS to populate the page with the relevant data for each contact.

Let me know if more clarification is needed. Cheers!
Jun22
Participant

Dynamic Pages Using CRM Objects

SOLVE

Hello Syeda , 

I am very happy you gave me something idea that can get through. 

Btw mam , Hope you can give me some tutorial how to request a Deals API can you check the image below uploaded mam is that endpoint will be the one to be used ? I been trying to run the code on the right panel and inserted on the javascript section on my design manager already but its always failing. 😱  Can you show me a sample coded that can make the request working mam thanks.  

Does it need to run Nodejs on my pc first mam ? inorder to make the code work mam ?

Jun22_0-1672989220752.png

 




0 Upvotes
Syeda_Fatima
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Dynamic Pages Using CRM Objects

SOLVE

Hi @Jun22, There are several tutorials available online that can help you learn how to request a Deals API. Here is a great tutorial from DigitalOcean that covers the basics: 

 

https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-api-v2 

 

It includes step-by-step instructions for setting up an API request, as well as a sample code that you can use to make a request.

 

If you are using the JavaScript code provided in the right panel, then you can use the following code sample to make a request (note: you will need to replace the sample API key and URL with your own):

 

var API_KEY = "YOUR_API_KEY";

 

var API_URL = "https://api.digitalocean.com/v2/deals";

 

var request = new XMLHttpRequest();

 

request.open("GET", API_URL, true);

 

request.setRequestHeader("Content-Type", "application/json");

 

request.setRequestHeader("Authorization", "Bearer " + API_KEY);

 

request.onload = function () {

  if (this.status >= 200 && this.status < 400) {

    // Success

    var data = JSON.parse(this.response);

    console.log(data);

  } else {

    // Error

    console.log("Error");

  }

};

 

request.send();

Jun22
Participant

Dynamic Pages Using CRM Objects

SOLVE

Hello syeda, 

I made make a request to the Deals API to get the deal object associated already. Right now what I need is where I can see a sample code of "HubSpot's JavaScript API to capture the click events from the deals and then build out a URL for the page you'd like the user to be redirected to."

Jun22_0-1676630882736.png

 

0 Upvotes