Help for Webhook

I called API for Subscribe To API.

Request
URL : POST https://api.twitch.tv/helix/webhooks/hub
Header :
Client-ID: {myClientId}
Authorization: Bearer {myAccessToken}
{
“hub.mode”:“subscribe”,
“hub.topic”:“https://api.twitch.tv/helix/entitlements/drops?game_id={gameId}&first=1”,
“hub.callback”:“https://{callbackDomain}/webhook”,
“hub.lease_seconds”: 864000
}

Response
HttpStatus 202

And then, I checked Webhook by GetWebHookSubscriptions API.
But I got a empty data.

Request
URL : GET https://api.twitch.tv/helix/webhooks/subscriptions
Header :
Client-ID: {myClientId}
Authorization: Bearer {myAccessToken}

Response
Body : {“total”:0,“data”:[],“pagination”:{}}

To check webhooks you need an app access token. From your code it seems like you’re using the same user access token.

This suggests that your Callback didn’t respond to the HTTP Get request with the challenge in order to complete the webhook initialization

  • You make a HTTP Post request to Twitch.
  • Twitch says 202
  • Twitch then makes a HTTP GET to your specified callback.
  • You check the data to check it’s expected and echo out the hub.challenge that Twitch sends as a query parameter.

That completes the webhook initialise and it’ll then show in the webhooks/subscriptions endpoint.

Twitch will the HTTP Post data your your specified callback when data occurs.

If the token is of the wrong type, then you’d get a HTTP auth error not a response and a payload of no webhooks.

I used a app access token.

https://id.twitch.tv/oauth2/token?client_id={clientId}&client_secret={clientSecret}&grant_type=client_credentials

{
“access_token”: “xxxxxxxxxxxxxxxxxxxxxxxxxx”,
“expires_in”: 5543713,
“token_type”: “bearer”
}

I am waiting a chellenge call. But Twitch did not call to GET callback URL.

The webhooks reference don’t list the Entitlements endpoint as a valid topic: https://dev.twitch.tv/docs/api/webhooks-reference

The Drops 2.0 documentation at one point did have mention of a webhook but this has since been removed as there is not currently a webhook for that endpoint.

@ConcreteEntree on the TwitchDev Discord had this to say about the entitlements endpoint:

Thank you. It was difficult today with this problem. Your answer can complete the day.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.