User Follows Webhook -- Update

In preparation for moving Webhooks into General Availability, we did a full audit to ensure we comply with the WebSub specification. There was one major deviation still unresolved: the User Follows webhook.

As of this week, the User Follows webhook has been corrected to fully comply with the WebSub spec. The documentation has been updated here.

Interesting Changes

Firstly, the topic string has changed:
Before: https://api.twitch.tv/helix/users/follows?to_id=1337
After: https://api.twitch.tv/helix/users/follows?first=1&to_id=1337.

Secondly, the notification payload has been updated to match the Helix payload. No longer do you need separate data models for Helix and Webhooks!

Please update your subscriptions!

Note that during this transition, the older User Follows webhook will still be available. All subscriptions that used the older webhook model are functioning as normal.

We’ll deprecate the older User Follows webhooks in one month. Please take the time to do your migrations thoughtfully, and let us know if there’s anything we can do to help.

3 Likes

Hey!

Nice that you are consistent with your api now.
But… the new topic isnt working for me at the moment.
I just get BadRequests back.
Changed back to the old topic and its working again.

You might be running into the same problem I had initially.

Make sure that if your request looks like this

https://api.twitch.tv/helix/webhooks/hub
?hub.mode=subscribe
&hub.topic=https://api.twitch.tv/helix/users/follows?first=1&to_id=1337
&hub.callback=https://yourwebsite.com/path/to/callback/handler
&hub.lease_seconds=864000
&hub.secret=s3cRe7

That you’re escaping the ampersand in the topic as such

https://api.twitch.tv/helix/webhooks/hub
?hub.mode=subscribe
&hub.topic=https://api.twitch.tv/helix/users/follows?first=1%26to_id=1337
&hub.callback=https://yourwebsite.com/path/to/callback/handler
&hub.lease_seconds=864000
&hub.secret=s3cRe7

or your request is actually doing this:

https://api.twitch.tv/helix/webhooks/hub
?hub.mode=subscribe
&hub.topic=https://api.twitch.tv/helix/users/follows?first=1
&to_id=1337
&hub.callback=https://yourwebsite.com/path/to/callback/handler
&hub.lease_seconds=864000
&hub.secret=s3cRe7
1 Like

Excellent write-up! As another option, those params can also go in the body:

url -X POST -H 'Client-ID: client-id-here' -H 'Content-Type: application/json' -d
'{
    "hub.mode": "subscribe",
    "hub.topic": "https://api.twitch.tv/helix/users/follows?first=1&from_id=1337",
    "hub.callback": "https://yourwebsite.com/path/to/callback/handler",
    "hub.lease_seconds": 864000,
    "hub.secret":"s3cRe7"
}'
https://api.twitch.tv/helix/webhooks/hub

The documentation will soon be updated to reflect this :grin:

1 Like