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”:{}}
WLG3R
August 31, 2020, 2:36am
2
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.
Dist
August 31, 2020, 8:35am
6
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:
ConcreteEntree:
In short, there’s not a webhook presently, just the endpoint- feel free to poll to keep your entitlement db in check. we do provide a unique ID per each entitlement so you can more easily track status on them.
Thank you. It was difficult today with this problem. Your answer can complete the day.
system
Closed
October 9, 2020, 4:41am
10
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.