APIs & Integrations

Jkroonen
Participant

Webhook API creating a subscription

SOLVE

Hi,

 

We want to make use of the Webhook API of HubSpt. So we make use of the HubSpot PHP API client. I wrote a service class in our Laravel project to interact with the client.

 

We make use of OAuth 2.0 implementation. Any endpoint works as expected, except for "/webhook" endpoints. Below is the problem.

 

When I try to make the following HTTP request:

POST https://api.hubapi.com/webhooks/v3/APP_ID/subscriptions
- headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer ACCESS_TOKEN"
}
- body: {
"event_type": "ticket.propertyChange",
"property_name": "status",
"active": true
}

 

The HubSpot respond with the following:

HTTP 401 Unauthorized
- body: {

"status": "error",
"message": "Authentication credentials not found. This API supports both API Key and OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview",
"correlationId": "8cf5ae15-0824-4941-b533-5c30d5c5aaa4",
"category": "INVALID_AUTHENTICATION"
}

Has anyone run into the same problem and how did you solve it? Or am I doing something wrong?

 

Thank you in advance!

0 Upvotes
1 Accepted solution
Jkroonen
Solution
Participant

Webhook API creating a subscription

SOLVE

I've read the documentation again and some other threats, and now it works. I solved the problem by generating a "HubSpot Developer Key". This must be used as "API Key".

 

Now I getting the following response:

HTTP 400 Bad Request
- body: {
...
"message": "Failed to handle unknown subscription type `ticket.propertyChange`. Please contact support."
}

Anyone encountered a similar issue?

View solution in original post

5 Replies 5
caio-pizzol
Participant

Webhook API creating a subscription

SOLVE

Hey everyone and HubSpot team @Willson ,

 

Apparently Webhooks endpoint only accepts API Keys but at the same time - API Keys have been deprecated from HubSpot last Nov 30th 2022 

How should we proceed in this case? I tried authenticating with both OAuth and Private Apps access tokens but the only response I receive back is 401 Unauthorized

 

Any help here?

0 Upvotes
Willson
HubSpot Employee
HubSpot Employee

Webhook API creating a subscription

SOLVE

Hey @caio-pizzol ,

 

Our Webhooks APIs all work to create the config via a Developer App, not a standard HubSpot Account where the Hapikey is used. 

 

As such, requests must be authenticated using a Developer API Key which is separate to the Hapikey functionality that we have deprecated. Please see here for more information:

https://legacydocs.hubspot.com/docs/faq/developer-api-keys

 

Thanks!

Product Manager @ HubSpot
caio-pizzol
Participant

Webhook API creating a subscription

SOLVE

Thanks for the quick reply @Willson 

 

I wasn't aware about Developer API Keys, thanks for the heads up.

 

It worked perfectly.

 

Cheers,

Caio

Jkroonen
Solution
Participant

Webhook API creating a subscription

SOLVE

I've read the documentation again and some other threats, and now it works. I solved the problem by generating a "HubSpot Developer Key". This must be used as "API Key".

 

Now I getting the following response:

HTTP 400 Bad Request
- body: {
...
"message": "Failed to handle unknown subscription type `ticket.propertyChange`. Please contact support."
}

Anyone encountered a similar issue?

Willson
HubSpot Employee
HubSpot Employee

Webhook API creating a subscription

SOLVE

Hey @Jkroonen ,

 

You're getting this response as the 'ticket.propertyChange' isn't quite ready for release yet. This is a work in progress and our docs were a step ahead, apologies for the confusion. 

 

We're updating the docs and will roll this out as soon as it's ready. 

 

Thanks

Product Manager @ HubSpot