Webhook life time different from requested

I make this request to Twitch:
await axios.post(
https://api.twitch.tv/helix/webhooks/hub’,
{
‘hub.callback’: ${process.env.URL_CALLBACK_BOT}/callback/bot,
‘hub.mode’: ‘subscribe’,
‘hub.topic’: ${URL_TWITCH_SUBSCRIBE_EVENT}?broadcaster_id=${twitchAccountID}&first=1&user_id=${process.env.BOT_ID},
‘hub.lease_seconds’: ‘3636’, // 1:01h
‘hub.secret’: ${process.env.BOT_SECRET_KEY}
},
{
headers: {
Authorization: Bearer ${userToken},
‘Client-Id’: ${process.env.TWITCH_CLIENT_ID}
}
}
);

I can get a successful response from Twitch, but at some of this responses the life time of the subscription is different than I put on request. Anyone know what is happening??

One of responses with different life time:
{
‘hub.challenge’: ‘7wJLEZY_yOjCWWzV4iB04_4bOdBqawfl0FYY9Sr-’,
‘hub.lease_seconds’: ‘2695’,
‘hub.mode’: ‘subscribe’,
‘hub.topic’: 'https://api.twitch.tv/helix/moderation/moderators/events?
broadcaster_id=<user_id>&first=1&user_id=<bot_id>
}

As per the spec

The requested lease time can be ignored.

The lease time is set as follows

if the time left on the token is less than the request lease time
Use the time left on the token

Otherwise use the requested time, up to 10 days

So for the mod events topic.

The max time is four hours as a regular user oAuth token is valid for up to four hours.

Then refresh the token and recreate the subscription

1 Like

Ahhh I got it, thanks a lot

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