`Subscriptions` webhooks ignores lease_seconds param?

messages using a lease_seconds of 24h (86400), which is working as intended, receiving the new subscription confirmation and the messages as they occur.

Yesterday I noticed that one of our clients did not have the Subscription event on the front-end triggered when a new user subs.

After some investigation, I realized that the subscription webhook is always setting it’s lease seconds to 13549 seconds, but the followers webhook uses the subscribe message to set it;

Has anyone else faced this issue and/or know if this is a bug on Twitch API? I’d like to set the same expiration time for both messages instead of resubscribing to the subscription hub every four hours.

This is not a bug.

According to the specification for WebSub. The Hub can ignore the user provided lease_seconds

In this case it’s being set to the time left on the Token you have authenticated with. And a user Access token only lasts four hours.

So lease time goes

  • set lease to what is asked for
  • check token expire, if token expires earlier, use the token expire instead

So every four hours, you need to refresh the user access token (as it’s about to expire) then recreate the Webhook subscription for the subscriptions topic.

1 Like

I see, that makes sense. Thanks again @BarryCarlyon, I appreciate your help,

Welcome.

It’s not a super obvious thing!

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