I’m trying to pull HubSpot info into Google Sheets but I’m not great at coding. I found a tutorial using Google Apps Script, but it’s outdated because HubSpot stopped using API keys. Now I’m stuck.
Here’s what I’ve done so far:
function getHubSpotContacts() {
var endpoint = 'https://api.hubapi.com/crm/v3/objects/contacts?limit=10&archived=false';
var accessToken = 'YOUR_ACCESS_TOKEN_HERE';
var options = {
'headers': {
'Authorization': 'Bearer ' + accessToken
},
'method': 'get'
};
var response = UrlFetchApp.fetch(endpoint, options);
var data = JSON.parse(response.getContentText());
// Process and display data in spreadsheet
// (code for this part omitted for brevity)
}
I changed the URL and added the access token, but I’m not sure if it’s correct. Can someone help me fix this script so it works with the new HubSpot API authentication method? Thanks!