Get feedback submissions in custom CRM Card Project

Hi there,

I am trying to fetch feedback submissions with private app’s access token inside custom CRM Card, but failed with response:

{"status":"error","message":"Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview","correlationId":"459ab63f-1fca-4b07-b56e-fdb2a417095e","category":"INVALID_AUTHENTICATION"} 
Request ID: 93391b24-94c4-47d2-a615-a3aa99784092

This is the code:

const hubspot = require('@hubspot/api-client');
exports.main = async (context, sendResponse) => {
 const hubspotClient = new hubspot.Client({ accessToken: context.secrets.PRIVATE_APP_ACCESS_TOKEN,});
 const result = await hubspotClient.crm.objects.feedbackSubmissions.basicApi.getPage();

...

}

Hi @HPham71, Try by adding this line in the end of your code:
sendResponse(result);
};

If this still not working then in order to successfully retrieve feedback submissions with a private app’s access token, you will need to use the OAuth 2.0 authorization flow. This requires you to register your app with HubSpot and receive an OAuth 2.0 access token.

Once you have the OAuth 2.0 access token, you can use it to make API calls to the HubSpot API.

You can refer to the added doc for more details on how to use the OAuth 2.0 authorization flow to access HubSpot data here: Accounts Dashboard | HubSpot

Hope this helps. Cheers! :slightly_smiling_face:

Hi @Syeda_Fatima ,

Thanks for your support.