APIs & Integrations

Stano
Member

Do I need to use access_token when working with webhooks via API?

Hi! I’m implementing HubSpot in our app via API. After reading the docs, I found out I need a testing portal to test authorization, but a developer account so I get the HAPIKEY - to be able to work with webhooks via API.

Our app works the way that it authorizes and then it subscribes the webhooks (having access_token from testing portal in the request header) and it gives me this:

POST https://api.hubapi.com/webhooks/v1/XXXXX/subscriptions?hapikey=XXXXX&userId=XXXXXresulted in a400 Bad Request` response: {“status”:“error”,“message”:"Request implies conflicting values for hub-id: XXXXX from [hapikey (XXXXX (truncated…)

When I remove the access_token from the header it works just fine. Is that the way to go? Or am I supposed to work with webhooks without authorization?

Thanks for help!

0 Upvotes
2 Replies 2
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Do I need to use access_token when working with webhooks via API?

Hi @Stano,

Using the Webhooks API requires OAuth authentication, but this applies to portals installing your app (like a test portal). If you’re using the API to manage your subscriptions, you’ll need the API key to your developer portal, since the subscriptions are related to your app, not a specific portal.

0 Upvotes
HanaCl
Member

Do I need to use access_token when working with webhooks via API?

Hi @Derek_Gervais I am only finding this answer, but can you post here the exact URL, that should be set and call your API to register the Webhook? And can you pls tell me, what shall I include to headers as well? I tried everything, still having errors last 2 days, I didnt like your documentation btw, it could be nice to have some playground or exact examples, cuz I cant find, which API should i use, where can I find it etc. there are many API keys.....can you pls describe it more specificaly?

0 Upvotes