Twitch API seems to be sending incorrect data

I just recently started using the twitch API and I subscribed to a webhook, and the subscription works perfectly, I get the events I want. However I’m getting data that doesn’t correlate to what’s going on.

I’m trying to see when I go live. Right now, I just log the data the webhook gives me. When I start streaming, nothing seems to happen (I’ve waited up to 2 minutes), when I stop streaming, however, I get many posts to my endpoint.

I only started and stopped streaming a single time and got 8 posts (Initial post isn’t shown. The blacked out parts are sensitive). I’m not sure where I went wrong, but if you know why this happens, any help would be appreciated.

Are the notifications duplicates? If they are it’s usually a sign your server isn’t correctly responding with a 200 status code in a timely manner, so Twitch attempts redelivery of the notification.

Doesn’t seem to be, it sends different data sometimes (empty ones signaling the stream ended). I tested it a couple times as well and it seems to be 8 posts every time and only after I end the stream.

Check the headers of the request you’re being sent, each notification will have a webhook notification ID that you can use to check if it’s a duplicate or not.

keep in mind that you’re not guaranteed to receive notifications in order, so it’s possible if you change things on your stream too quickly it can trigger notifications being sent that arrive out of order which can sometimes lead to the appearance of incorrect data.

After logging the headers, the ID’s are different. So it isn’t a duplicate. All I really care about is getting the empty data and my server thinks the stream went offline because it sent an empty object.

It seems you need to send a 200 with the body “OK” for it to actually register as being accepted. It works now.

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