CMS Development

mansigovani
Contributor

Custom Website Page to Pull Company Details from Hubspot

SOLVE

Hello all,

For internal use, I want to develop a page which displays the list of all the companies present in our Hubspot account. But looks like my code doesn't run through While loop. 

Also, I am not sure if {{ company_domain}} is correct. I don't want my company domain. I want Contacts Company domain. 

 

<script>

while({{ company_domain}}){

     var item=[];

item=["{{company_domain}}","{{company_state}}", "{{company_country}}" ];

var e = item.toString();

document.getElementById("result1").innerHTML = e;

end

}

</script>

<button type="button" onclick="state1();">Click Me!</button>

<p><span id="result1">&nbsp;</span></p>

0 Upvotes
1 Accepted solution
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Custom Website Page to Pull Company Details from Hubspot

SOLVE

@mansigovani Yes, unfortunately, due to security reasons, a multitude of Hubspot's APIs can't be used directly on Hubspot because they'd either need to be written in something other than Javascript or use Ajax with CORS (which Hubspot doesn't allow to be set). You would need to make the request to the API on an external site.

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

6 Replies 6
sharonlicari
Community Manager
Community Manager

Custom Website Page to Pull Company Details from Hubspot

SOLVE

Hey @mansigovani       

 

I apologize for the delay in getting back to you. I am wondering if you were able to resolve this or if you still need assistance on this matter?  If so, could you please share the URL?

 

Thank you

Sharon


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Upvotes
mansigovani
Contributor

Custom Website Page to Pull Company Details from Hubspot

SOLVE

Hello @sharonlicari ,

 

No, I am nowhere near completion on that project. I tried a couple of different methods but I was not able to figure out the solution for it. 

Your help will be much appreciated. 

Just a brief idea of what I want as a result: A custom web page, where I can filter three of my Hubspot Company properties: Country, State, and Customer Type. Based on those results, I should be able to get all the companies that match the filter criteria (Just like the HubSpot CRM Companies Page) but a web page.

I hope that makes sense and you will be able to help me out here. 

Thank you in advance!
Mansi

0 Upvotes
alyssamwilie
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Custom Website Page to Pull Company Details from Hubspot

SOLVE

Hey @mansigovani ,

 

Any Hubl property variables are only going to pull the contact properties associated with the current user. To output a list of all companies or particular properties you would need to use the Hubspot API.

https://developers.hubspot.com/docs/methods/companies/get-all-companies

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
mansigovani
Contributor

Custom Website Page to Pull Company Details from Hubspot

SOLVE

Hello @alyssamwilie ,

Thank you for your quick response. Earlier I talked to HubSpot support, and he coordinated with developers on this. Please see the attached screenshot.

 

screenshot-app.hubspot.com-2019.12.png

 

Here's the sample of code from  https://www.youtube.com/watch?v=p8Ov-egc8hU
<script>

const request = require('request');

function company(){

try{

const companies = await request({

method: 'GET',

url: `https://api.hubapi.com//companies/v2/companies/paged`,

qs: { hapikey: `aaaaa`, count: 100, }, json: true });

 

document.getElementById('result1').innerHTML = companies;

}

</script>

<button type="button" onclick="company();">Click Me!</button> <p><span id="result1"> </span></p>
------------------------

And I need to add three filter criteria and then pull the data based on it. So I am not sure how to use API without Javascript.

 

Thank you!!
Mansi

0 Upvotes
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Custom Website Page to Pull Company Details from Hubspot

SOLVE

@mansigovani Yes, unfortunately, due to security reasons, a multitude of Hubspot's APIs can't be used directly on Hubspot because they'd either need to be written in something other than Javascript or use Ajax with CORS (which Hubspot doesn't allow to be set). You would need to make the request to the API on an external site.

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
sharonlicari
Community Manager
Community Manager

Custom Website Page to Pull Company Details from Hubspot

SOLVE

Hey @mansigovani 

 

Thank you for your fast response. I will tag a few of our experts to give you some tips about this.             

 

Hey @DanielSanchez @alyssamwilie @Kevin-C  could you please share your knowledge with @mansigovani   

 

Happy Friday,

Sharon 🙂


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Upvotes