APIs & Integrations

jaswants
Member

How to Join Campaigns with Contacts fetched using API

Hi, I have Fetched all contacts list and campaign list to create a report. I am getting values like "49b6d4e1-33b8-45be-8c2d-9ef235645663" in "First Touch Converting Campaign" field inside contacts data and that supposed to be a campaign. But while fetching a campaign data, I am getting campaign id's an integer format like '75356022'. 

 

So how could I be able to join these tables and get a name respective to  "First Touch Converting Campaign" value? 

0 Upvotes
1 Reply 1
WendyGoh
HubSpot Employee
HubSpot Employee

How to Join Campaigns with Contacts fetched using API

Hi @jaswants,

 

I hope all is well with you 😃

 

It looks like you're currently getting the campaign data using this endpoint: Get campaign IDs sorted by recent activity for a portal | Email Events API, am I right? This endpoint will return the internal HubSpot ID associated with a particular email in the Email tool. As an example in my own portal:

internal hubspot id.png

 

This ID is not the same as the campaign ID in the Campaigns tool. Currently, while it is not possible to retrieve the campaign IDs via API, the Campaign ID can be retrieve in the URL itself. An example that Isaac shared over in this similar discussion forum: Solved: HubSpot Community - Retrieve all campaign IDs in my portal - HubSpot Community is:

 

https://app.hubspot.com/campaigns/{Hub_ID}/#details/e5d960a2-8386-4884-a021-ac84d81eacd9/content
  • The campaign ID in this case is e5d960a2-8386-4884-a021-ac84d81eacd9

 Moving forward, I'd suggest for you to give this idea HubSpot Community - Complete Hubspot Campaigns API - HubSpot Community a upvote and comment if you'd like a public API to fetch campaigns ids in the campaign tools.

0 Upvotes