No reponse from Webhook

Im trying to use web hocks and using ngrok free,

Using SSL labs with my webhook links comes back as A
ive checked and subscription is created
Using twitch CLI for test it works, but when ever i unmod someone in my channel i do not get any response at all, Any idea

def subscribe_to_unmod_events():
app_access_token = get_app_access_token() # Get the access token
if app_access_token:
headers = {
‘Client-ID’: CLIENT_ID,
‘Authorization’: f’Bearer {app_access_token}',
‘Content-Type’: ‘application/json’
}
data = {
‘type’: ‘channel.moderator.add’,
‘version’: ‘1’,
‘condition’: {
‘broadcaster_user_id’: ‘782603054’
},
‘transport’: {
‘method’: ‘webhook’,
‘callback’: SUBSCRIPTION_CALLBACK,
‘secret’: webhook_secret
}
}

You’re subscribing to the topic for when users get modded, not unmodded. For unmodded you’d want channel.moderator.remove.

Thank you but it dosnt trigger for that either for some reason (sorry tried both), been at it a few days can not figure it out

like a say twitch cli triggers it ok

twitch event trigger add-moderator -F https://########.ngrok-free.app/webhook
✔ Request Sent. Received Status Code: 200
✔ Server Said: {
“success”: true
}

{“subscription”:{“id”:“8f039bb9-bbab-785b-eb5a-9b3bc9419e63”,“status”:“enabled”,“type”:“channel.moderator.add”,“version”:“1”,“condition”:{“broadcaster_user_id”:“65697881”
},“transport”:{“method”:“webhook”,“callback”:“null”},“created_at”:“2024-04-03T15:00:43.3903874Z”,“cost”:0},“event”:{“user_id”:“52170749”,“user_login”:“testFromUser”,“user
_name”:“testFromUser”,“broadcaster_user_id”:“65697881”,“broadcaster_user_login”:“testBroadcaster”,“broadcaster_user_name”:“testBroadcaster”}}

Have you used Get EventSub Subscriptions and confirmed that the subscriptions have the enabled status?

Thank you for the reply. sorry first time doing anything with Webhooks, managed to confirm the call back verifcation has failed but can not work out why

here is my route code

@app.route(‘/webhook’, methods=[‘GET’, ‘POST’])
def handle_webhook():
if request.method == ‘GET’:
# Extract the challenge parameter from the query string
challenge = request.args.get(‘challenge’)
print(“Challenge:”, challenge) # Print the challenge parameter
if challenge:
# Respond to the verification challenge with the provided value
return challenge, 200, {‘Content-Type’: ‘text/plain’}
else:
# Respond with an error if no challenge is provided
return ‘Invalid request’, 400
elif request.method == ‘POST’:
try:
data = request.json
# Process the event data here
return jsonify({‘success’: True})
except Exception as e:
print(“Error handling webhook:”, e)
return jsonify({‘success’: False, ‘error’: str(e)})

I’m more of a NodeJS person so I’m not completely familiar with the language you’re working in, but it looks like there’s a couple issues.

If you refer to the docs on responding to a challenge, https://dev.twitch.tv/docs/eventsub/handling-webhook-events/#responding-to-a-challenge-request, you’ll see that it’s a POST request, not a GET, and the challenge is in the request body, not a query param.

You can test if the verification is working correct with the Twitch CLI https://dev.twitch.tv/docs/cli/event-command/#verifying-your-event-handlers-challenge-response

Thank you very much that has helped and got me past that part and now got all clear on Twitch CLI and its recieving the webhook back (although 400 bad request) as its Midnight here im going to pause for the night and revisit it tomorrow, as this issue is now resolved will mark as resolved thanks again