API use of Salesforce campaign

Hey dev community - Going from answering questions to posing one:

Is there any API method at present to set/query the Salesforce campaign ID set on a Contact? I can only find a reference dated to 2018 to do this via a form - which seems a bit perverse. And the associated workfkow step doesn’t offer any parametrization which is another challenge.

Grateful for all help.

Steve

Hi, @SteveHTM :waving_hand: Welcome to the other side :wink: I don’t think you are missing something here.

If we make a request to the Properties API, the Salesforce properties come back as read-only. This is because the HubSpot-Salesforce integration is designed to respect the data governance rules of both platforms. Certain Salesforce properties are marked as read-only within HubSpot to maintain data integrity and consistency across both systems. This includes Salesforce campaign IDs, which are typically managed within Salesforce and synced to HubSpot through the integration setting.

You can include the related Salesforce property internal value in a query to the Contacts API endpoints and get back the value. I don’t have an example with Salesforce Campaign ID, but I do for a different Salesforce property:

Request

curl --request GET \
 --url 'https://api.hubapi.com/crm/v3/objects/contacts/151?properties=salesforceleadid&archived=false' \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN'

Response

HTTP 200

{
 "id": "151",
 "properties": {
 "createdate": "2020-04-03T17:23:31.706Z",
 "hs_object_id": "151",
 "lastmodifieddate": "2023-03-24T05:11:58.368Z",
 "salesforceleadid": "00Q4R00001J7LBVUA3"
 },
 "createdAt": "2020-04-03T17:23:31.706Z",
 "updatedAt": "2023-03-24T05:11:58.368Z",
 "archived": false
}

In summary, this isn’t currently possible outside the syncing done via the HubSpot-Salesforce integration. If I am misunderstanding what you’re after, please let me know.

Best,

Jaycee

@Jaycee_Lewis - Thanks for the perspective on Salesforce data in general, which I can is consistent with the overall setup of thes etwo systems.

But we do have a specific “window” into setting a Salesforce Campaign ID, offered in the form of a discrete and unique workflow step. I was hoping that there might be an API mechanism equivalent to that workflow step which would enable me to take a Salesforce Campaign ID value stored in a normal Contact property and add the contact to that Campaign in SFDC.

Steve