CRM Cards - API calls

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.

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!

Thanks for sharing this update with us, @PAtlan!

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

Thanks, @sejal_parikh :waving_hand: Hey, @PAtlan just want to make sure you saw this :eyes: — Jaycee