HubSpot API Integration


#1

Hello Team,

While doing HubSpot integration, we are facing issues in posting the “Lead Status” with contact details. We have added two new custom option values for “Lead Status” field (WON/LOST), but when posting the same details as property in the Create/Update contact API, receiving below error. Below are the request & response:

Request:

{“properties”:[{“property”:“firstname”,“value”:“Test”},{“property”:“lastname”,“value”:“Quacito”},{“property”:“email”,“value”:“prakash.k@infocratsweb.com”},{“property”:“address”,“value”:“1235 Safari St”},{“property”:“address_2”,“value”:""},{“property”:“city”,“value”:“San Antonio”},{“property”:“state”,“value”:“Tx”},{“property”:“zip”,“value”:“78216”},{“property”:“county”,“value”:“United State”},{“property”:“phone”,“value”:“210-695-0795”},{“property”:“hs_persona”,“value”:“persona_1”},{“property”:“location”,“value”:“010101”},{“property”:“service_code”,“value”:“AN”},{“property”:“target”,“value”:“OXPS”},{“property”:“hs_lead_status”,“value”:“Won”},{“property”:“lifecyclestage”,“value”:“customer”}]}

Response:

{“status”:“error”,“message”:“Property values were not valid”,“correlationId”:“ec078c44-5511-4f08-9be6-c7b5307e7081”,“validationResults”:[{“isValid”:false,“message”:“Won was not one of the allowed options: [label: “New”\nvalue: “NEW”\ndisplay_order: 0\n, label: “Open”\nvalue: “OPEN”\ndisplay_order: 1\n, label: “In Progress”\nvalue: “IN_PROGRESS”\ndisplay_order: 2\n, label: “Open Deal”\nvalue: “OPEN_DEAL”\ndisplay_order: 2\n, label: “Unqualified”\nvalue: “UNQUALIFIED”\ndisplay_order: 3\n]”,“error”:“INVALID_OPTION”,“name”:“hs_lead_status”}],“requestId”:“9c1807f4ef03df36018a00924a5984be”}


#2

Hi there,

Looking at the response, it looks like the label for your Lead Status property is ‘New’, while the value is ‘NEW’. The label is how the property is displayed in the HubSpot UI, but the value should be used to set that property via API. It looks like you were passing a value of “Won”, when you should try passing a value of “WON”. Feel free to DM me if you still need help.

Also a friendly fyi: You should exclude/obscure the hapikey from your portal when posting to this forum, as the hapikey can be used to access data from your portal by anyone with access to it. Cheers!


#3

I tried sending “WON” status, but again receiving the same response. Refer the below details:

Request:

{“properties”:[{“property”:“firstname”,“value”:“Test”},{“property”:“lastname”,“value”:“Quacito”},{“property”:“email”,“value”:“prakash.k@infocratsweb.com”},{“property”:“address”,“value”:“1235 Safari St”},{“property”:“address_2”,“value”:""},{“property”:“city”,“value”:“San Antonio”},{“property”:“state”,“value”:“Tx”},{“property”:“zip”,“value”:“78216”},{“property”:“county”,“value”:“United State”},{“property”:“phone”,“value”:“210-695-0795”},{“property”:“hs_persona”,“value”:“persona_1”},{“property”:“location”,“value”:“010101”},{“property”:“service_code”,“value”:“AN”},{“property”:“target”,“value”:“OXPS”},{“property”:“hs_lead_status”,“value”:“WON”},{“property”:“lifecyclestage”,“value”:“customer”}]}

Response:
{
“status”: “error”,
“message”: “Property values were not valid”,
“correlationId”: “2e9ea6e2-d612-47f5-b3e2-1f8a102613e8”,
“validationResults”: [
{
“isValid”: false,
“message”: “WON was not one of the allowed options: [label: “New”\nvalue: “NEW”\ndisplay_order: 0\n, label: “Open”\nvalue: “OPEN”\ndisplay_order: 1\n, label: “In Progress”\nvalue: “IN_PROGRESS”\ndisplay_order: 2\n, label: “Open Deal”\nvalue: “OPEN_DEAL”\ndisplay_order: 2\n, label: “Unqualified”\nvalue: “UNQUALIFIED”\ndisplay_order: 3\n]”,
“error”: “INVALID_OPTION”,
“name”: “hs_lead_status”
}
],
“requestId”: “f210bf8ded2675bf36374a4ca7814bcc”
}


#4

Sorry, the last line of my response was a bit of a dyslexic moment…
Your initial call, you were trying to pass a value of “New”, when you should have been trying to pass a value of “NEW” (“WON” was just me scrambling up the letters.) Let me know how this goes!


#5

Sorry for the confusion. I have sent you the wrong json in my initial post. We are facing issues in posting the custom values, we have added in “Lead Status” field that is (WON / LOST). For debugging, please refer the second json with “WON” status. Below the below image. Hope this clarifies the issue.


#6

Based on the URL in your screenshot, it looks like you’ve added WON/LOST values to the company property “Lead Status”, not the contact property, which doesn’t exist in that portal https://app.hubspot.com/property-settings/2212447/contact/hs_lead_status


#7

Thanks for the information.

Currently, we don’t have this property for Contacts. Can we add same property for “Contact”? Just wanted to confirm that adding this field will not create any conflict with the existing field.


#8

Shouldn’t be an issue with adding a custom contact property with the same name as the company property.


#9

Sounds Good!

Thanks for your help.