Webhooks does not send requests when a subscription is triggered


#1

I do a Webhooks subscription to follows and streams:


POST to https://api.twitch.tv/helix/webhooks/hub with data:
hub.callback=http://{myIP}:4747/twitch&hub.mode=subscribe&hub.topic=https://api.twitch.tv/helix/users/follows?to_id=229132352&hub.lease_seconds=1200

Headers:
Authorization: Bearer {token}


POST to https://api.twitch.tv/helix/webhooks/hub with data:
hub.callback=http://{myIP}:4747/twitch&hub.mode=subscribe&hub.topic=https://api.twitch.tv/helix/streams?user_id=229132352&hub.lease_seconds=1200

Headers:
Authorization: Bearer {token}


I get a response of 202 Accepted. A request comes to my server in which I respond with code 200 and the content contains hub.challenge.

I check for subscriptions and see that they are:


POST to https://api.twitch.tv/helix/webhooks/subscriptions
Headers:
Authorization: Bearer {token}

In response, I get
{"total":2,"data":[{"topic":"https://api.twitch.tv/helix/streams?user_id=229132352","callback":"http://{myIP}:4747/twitch","expires_at":"2019-09-16T11:30:37Z"},{"topic":"https://api.twitch.tv/helix/users/follows?to_id=229132352","callback":"http://{myIP}:4747/twitch","expires_at":"2019-09-16T11:40:35Z"}],"pagination":{}}

As I understand it, everything is in order and I should get topics when the stream is turned on or follows the channel. I start the stream and follow in the channel, wait 10+ minutes, but the topics never come.

What am I doing wrong? How can i fix this?


#2

You set the lease_seconds to 1200 that is only 20 minutes.

I’d suggest that your hook expired before it was time to send data.

But you should also check your server logs for incoming POST’s and ensure you are handling POST’s

Clearly the GET’s are working as your successfully created the subscriptions.

Additionally https://api.twitch.tv/helix/users/follows?to_id=229132352 should be https://api.twitch.tv/helix/users/follows?to_id=229132352&first=1 the former does work as it was the “original” topic but the correct topic requires first=1 for follows. Your streams topic is correct


#3

Thanks for the quick answer!

I use 20 minutes as a test - I do not need more. As soon as I subscribe, I go the subscription requirements within a minute (start stream and follow).

POST is exactly supported on the server.

I also initially tested with “&first=1” but that didn’t change anything :frowning:


#4

The non first=1 topic will be disabled at some point

The correct topic is https://api.twitch.tv/helix/users/follows?to_id=229132352&first=1

The data in the payloads is different for the old topic compared to the new/correct topic.

As far as I can see there is nothing wrong as my code that consumes the same topics (for different streamers naturally) is working correctly.

Check the logs anyway to see if a POST hit but didn’t hit your code for whatever reason.

Set it longer as you can always unsubscribe/terminate a hook subscription instead, rather than setting it to a shorter time and risking the hook expires instead.

Also, I think all hooks need to be over SSL, that might be a factor

Both your hook callbacks are non ssl in your response. So mixing SSL’s here?


#5

I checked. I send POST to my server and they are in the logs. No Weebhooks requests in logs with streams or follows topics.

Ok, I’ll try a bigger time and let you know about the result.

No, I do not use SSL.
Just my server is located on port 4747 for testing and debugging.


#6

Sorry, this is a problem in my server.
It’s just that the server was written completely by me and it so happened that it broke and closed the request when I tried to write the logs of the response from Webhooks subscription. It turns out that he just killed the thread with the connection and because of this I could not see the result! :scream:


#7

All good I thought it might be!


closed #8

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