Bad Request - Invalid Transport

I am trying to create an EventSub subscription for a python bot by following Twitch’s API documentation, but I’m getting an invalid transport error and there’s no activity on my ngrok endpoint when I call the post request. The transport section of the body seems pretty straightforward, am I wrong or have I done something else incorrectly? Thanks very much for any assistance.

headers = {
    'Client-ID': config['CLIENT_ID'],
    'Authorization': 'Bearer ' + config['ACCESS_TOKEN']

body = {
    'type': 'channel.follow',
    'version': '1',
    'condition': {
        'broadcaster_user_id': config['BROADCASTER_ID']
    'transport': {
        'method': 'webhook',
        'callback': ngrok_endpoint,
        'secret': secret

r =

Returns: {'error': 'Bad Request', 'status': 400, 'message': 'invalid transport'}

You sent a HTTP post/form body instead of JSON body.

Also check that that you are using the SSL version of the ngrok endpoint

Awesome, thank you Barry. Do I just need to change the formatting of the dictionary, i.e. double quotes instead of single? Or do I need to make it an actual JSON object?

Appreciate the help

Actual JSON object. Changing quotes type doesn’t do anything

Thanks much

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