Webhook API Eventsub

Been trying to subscribe to couple events via webhooks.

Got my listener on 443 forwarding events to my service and i see the response as well as the challenge, so im trying to respond to it by doing a POST request but no matter what i’ve tried i keep getting the following error:

Response Status: 400 Bad Request
Response Header: map[Content-Length:[175] Content-Type:[application/json; charset=utf-8] Date:[Mon, 22 Apr 2024 04:07:23 GMT] Strict-Transport-Security:[max-age=300] Timing-Allow-Origin:[https://www.twitch.tv] Vary:[Accept-Encoding, Origin] X-Cache:[MISS, MISS] X-Cache-Hits:[0, 0] X-Served-By:[cache-bfi-krnt7300024-BFI, cache-chi-klot8100142-CHI] X-Timer:[S1713758843.141811,VS0,VS0,VE59]]
Response Body: {"error":"Bad Request","status":400,"message":"Must provide a valid Content-Type header with a request body. Please use application/json or application/x-www-form-urlencoded"}

these are the headers i’m passing.

req.Header.Set("Content-Type", "text/plain") 
req.Header.Set("Authorization", "Bearer <something>")
req.Header.Set("Client-Id", "<else>")                                                                                                                                                          

any guidance would be appreciated!

You respond to a challenge by echoing out the challenge response in the body like a HTML webpage just the text/plain challenge.

There is no POST or GET request to make, or any request at all. You just response/echo out the body.

PHP: twitch_misc/eventsub/webhooks/php/index.php at main · BarryCarlyon/twitch_misc · GitHub
NodeJS/Express: twitch_misc/eventsub/webhooks/nodejs/receive.js at main · BarryCarlyon/twitch_misc · GitHub

So I’m not sure what you are doing in response to the challenge. or what API endpoint you are calling with your challenge.

now that makes a lot more sense.
sorry didn’t fully understand the documentation.

got my subscription enabled thank you very much!