How to get stream data using New Twitch API - Webhook?

hello, guys.

i tried to get a webhook (stream up/down) using flask.
so i followed the example of webhook flow and succeeded in obtaining ‘hub.challenge’

Here are the results I received.

GET /webhook?hub.challenge=xb0Smtfnw1ai2Ndnbdtq4uqUKcYaxu40mzNfQhXn&hub.lease_seconds=864000&hub.mode=subscribe&{user_id}HTTP/1.1" 200 -

Then, What should i do to get a information of stream?

You need to echo the challenge back to twitch.

And then Twitch will send you webhooks as they happen.

As per the docs:

  1. Make subscription request


  1. Twitch then sends to your end point:



Then you take the hub.challenge and send a body response of the hub.challenge value

in PHP for example:

    echo $_GET['hub.challenge'];

(Bad example do not use in production™

Then, Twitch will send you events when they happen

Thank you for your reply.

I have a one more question.

If i send a response with ‘hub.challenge’ value, is there any other response from twitch?

Twitch makes a HTTP request to your end point like how you would load a website.

Twitch’s webhook validator is loading your webpage to see if you web page returns the requested hub.challenge. To validate the end point is valid.

After that the subscription is all setup and now you should get webhook notifications when they fire

Thanks for your reply.

I tried to send challenge(rendered in html), then finally i got a data about stream up event.

But, it’s a little bit delayed. about 2-3 minutes.

Appreciate it!

Steam Up/Down webhooks send when Helix shows the same data.

So for stream up, it’s about 3 minutes stream down is nearer six.

A Twitch Webhook payload of data matches the same data that should be in helix. So the webhook doesn’t fire until Helix matches

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