Hey folks,
I’ve used the mock-api succesfully to test predictions / other api things. However, I’ve been falling short testing my eventsub.
My question is: I notice that we can trigger eventsub events with the callback url using the twitch cli
. However, I do see that we need to subscribe before we can receive any events (at least, this is my understanding reading the eventsub documentation). I’ve never dealt with GO but I tried poking through the twitch-cli
repo and haven’t found anything in the endpoint folder. I’m sure I could’ve missed something though.
If it is possible, could anyone point out what I’m doing wrong in my local setup / test since I keep getting a 404 page not found when trying to subscribe to an event with my code.
I’ve followed the instruction here and have my mock-api server running at localhost:8080
. I’m able to do these two operations POST auth/token
and GET /mock/users
. However, as soon as I try to use the eventsub API, I get a 404.
In this case, I’m using python to post to the mock server and this is my code snippet:
data = {
'type': 'channel.follow',
'version': '1',
'condition': '{'broadcaster_user_id': '71045017'}',
'transport': {
'method': 'webhook',
'callback': 'https://e3e3-173-178-212-149.ngrok.io/callback',
'secret': [randomly generated secret]
}
}
response = self.__api_post('localhost:8080/ + 'eventsub/subscriptions', data=data)
the broadcaster_user_id
is generated by the mock-api
and the method __api_post
simply builds the headers and does a post
to subscribe to the event.
I’m sure I’m missing a step in here but I’ve been scratching my head for days and can’t figure it out.