APIs & Integrations

PAtlan
Contributor

CRM Cards - API calls

SOLVE

Hi, 

I'm trying to set up a custom card using the new CRM Development beta tools. Expanding on the sample project, I want to call the Hubspot API to get data (specifically, associated object properties) from the record on which the CRM Card is read. (Iniitally, I just want to read the Name and Record ID of the primary associated company)

 

The sample project shows a simple API call to zenquotes, a public API, and I can't find any discussion of authentication methods for the CRM cards. 

I thought of using my account's API key but these are soon to be deprecated. 

I'm assuming because my CRM project sits in it's own private app, that's the way to go? But a sample piece of code would do wonders, because my poor attempts have gotten me nowhere!

 

Thanks for any help.

 

Paul.

2 Accepted solutions
PAtlan
Solution
Contributor

CRM Cards - API calls

SOLVE

I'll reply to my own post for future reference, as further digging allowed me to find how to set up API calls inside a card: the process is described in the docs, 

https://app-eu1.hubspot.com/docs/{hubspot instance}/doc/platform/serverless-functions 

(obviously replace with your instance number)

 

It seems each project saves its token in variable PRIVATE_APP_ACCESS_TOKEN

so instanciating a hubspot Client like this:

const hubspotClient = new hubspot.Client({
accessToken: context.secrets.PRIVATE_APP_ACCESS_TOKEN,
});

works perfectly well!

View solution in original post

sejal_parikh
Solution
HubSpot Product Team
HubSpot Product Team

CRM Cards - API calls

SOLVE

Hello Paul, your finding is spot-on. In the future, using this community group would get you quicker answers https://community.hubspot.com/t5/CRM-Development-Tools-Beta/gh-p/crm-development-tools-beta

View solution in original post

4 Replies 4
sejal_parikh
Solution
HubSpot Product Team
HubSpot Product Team

CRM Cards - API calls

SOLVE

Hello Paul, your finding is spot-on. In the future, using this community group would get you quicker answers https://community.hubspot.com/t5/CRM-Development-Tools-Beta/gh-p/crm-development-tools-beta

Jaycee_Lewis
Community Manager
Community Manager

CRM Cards - API calls

SOLVE

Thanks, @sejal_parikh 👋 Hey, @PAtlan just want to make sure you saw this 👀 — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
PAtlan
Solution
Contributor

CRM Cards - API calls

SOLVE

I'll reply to my own post for future reference, as further digging allowed me to find how to set up API calls inside a card: the process is described in the docs, 

https://app-eu1.hubspot.com/docs/{hubspot instance}/doc/platform/serverless-functions 

(obviously replace with your instance number)

 

It seems each project saves its token in variable PRIVATE_APP_ACCESS_TOKEN

so instanciating a hubspot Client like this:

const hubspotClient = new hubspot.Client({
accessToken: context.secrets.PRIVATE_APP_ACCESS_TOKEN,
});

works perfectly well!

kvlschaefer
Community Manager
Community Manager

CRM Cards - API calls

SOLVE

Thanks for sharing this update with us, @PAtlan


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