I'm currently using VBA to interact with the HubSpot API (but I assume this question can also be answered by someone who is not familiar with VBA but knows the HubSpot API) and retrieve data about my deals. My existing function works flawlessly and allows me to fetch data from the /crm/v3/objects/deals
endpoint.
However, there is a feature in HubSpot where I can assign a closing probability to each deal stage (for example, "qualifiedtobuy" could have a 40% closing probability). I would very much like to fetch it programmatically.
I've scoured the HubSpot API documentation but haven't found a clear answer on whether or how I can fetch this deal stage probability data via the API. Would anyone here happen to know if this is possible, and if so, could you provide some guidance or point me to the relevant API endpoints or documentation?
Here's the function I'm currently using for reference:
Function GetHubspotDealData() As String
Dim objHttp As Object
Set objHttp = CreateObject("MSXML2.ServerXMLHttp")
Dim sUrl As String
Dim sSecretToken As String
sSecretToken = "my-secret-token"
sUrl = "https://api.hubapi.com/crm/v3/objects/deals"
objHttp.Open "GET", sUrl, False
objHttp.setRequestHeader "Authorization", "Bearer " & sSecretToken
objHttp.setRequestHeader "Content-Type", "application/json"
objHttp.send
GetHubspotDealData = objHttp.responseText
End Function
Any insights or even small hints would be greatly appreciated. Thank you!
With the right ideas from @Saeven, I was now able to solve the issue. I simply had to replace the endpoint https://api.hubapi.com/crm/v3/objects/deals
with the correct endpoint https://api.hubapi.com/crm/v3/pipelines/deals
. This will result in a JSON response containing all deal stages with their set names, internal names, display order, closing status, probabilities and some more information.
This is a working code example:
Function GetHubspotDealStageProbabilities() As String
Dim objHttp As Object
Set objHttp = CreateObject("MSXML2.ServerXMLHttp")
Dim sUrl As String
Dim sSecretToken As String
sSecretToken = "my-secret-token"
sUrl = "https://api.hubapi.com/crm/v3/pipelines/deals"
objHttp.Open "GET", sUrl, False
objHttp.setRequestHeader "Authorization", "Bearer " & sSecretToken
objHttp.setRequestHeader "Content-Type", "application/json"
objHttp.send
GetHubspotDealStageProbabilities= objHttp.responseText
End Function