POST error: Invalid transport

Hello,
I am a noobie in programming network-based programms.
I would like to use EventSub in python but I get the following error:
{‘error’: ‘Bad Request’, ‘status’: 400, ‘message’: ‘invalid transport’}
There is already a post about this error, but I didn’t understood the answer.
[EventSub - Trying to send the challenge response]

In python:
url = f"https://api.twitch.tv/helix/eventsub/subscriptions"
headers = {“Client-ID”: self.CLIENT_ID,
“Authorization”: “Bearer 2usysigpkwy25b427d8qz9h9vXXXXX”,
“Content-Type”: “application/json”}
post(url, headers=headers).json()

I don’t have a clue what’s going wrong.
Things I have tried:

Running this command in cmd (same error)
Expose a web server on port 80 using ngrok: ngrok http 443

Thanks in advance.

You seem to have not included a copy of your HTTP Post body for us to debug, so I’m guessing you didn’t send any at all. So that is likely your problem. You didn’t ask for a topic or specify a transport.

Here is a nodeJS example from my github

Relevant snippet

    var json = {
        type,
        version: "1",
        condition,
        transport: {
            method: 'webhook',
            callback: 'some url',
            secret: 'some jibberish'
        }
    };

Hello, pls , help me too. I make:

 method: 'POST',
  url: 'https://api.twitch.tv/helix/eventsub/subscriptions',
  headers:
   { 'Client-ID': '{{MY_CLIENT_ID}}',
     Authorization: 'Bearer {{APP_AUTH_TOKEN}}' },
  responseType: 'text',
  data: '{{challenge}}'

But response is :

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

See line 72/77 and 80 of

You are not replying to the challenge correctly.

You don’t send a POST request you just echo out the body.

Can you pls help me one more time. I still don’t understand. How to make it on Node.js?

I literally linked your a node.js example of a server application…

and

Are both node.js examples of an EventSub Server

Thanks, understood. I just need to make answer(response) string encodeURIComponent(req.body.challenge) for POST request from twitch

Correct