Webhook Callback URL not recieving Challenge

From Mobile Posting

Heh. That’s what happens when I write sample code and not test it whilst flying a spaceship

From the nodeJS request docs:

body - entity body for PATCH, POST and PUT requests. Must be a Buffer, String or ReadStream. If json is true, then body must be a JSON-serializable object.

And there is a hiccup in my sample post

I think the original problem was that you sent everything in the query string and send a header of content type JSON. And then didn’t send any JSON. And then Twitch API sent a 202 anyway

Excuse mistakes I’m on mobile

Updates at a computer:

request({method: "POST’, url: ‘https://api.twitch.tv/helix/webhooks/hub’, json: true, body: {“hub.mode”:“subscribe”,
“hub.topic”:“https://api.twitch.tv/helix/users/follows?first=1&to_id=1337”,
“hub.callback”:“https://yourwebsite.com/path/to/callback/handler”,
“hub.lease_seconds”:“864000”,
“hub.secret”: “s3cRe7”}, headers: { Client-ID: ‘xxxxx’ }

I omitted the " around s3cRe7

json - sets body to JSON representation of value and adds Content-type: application/json header. Additionally, parses the response body as JSON.

So the header should be optional but no harm setting it expliciciciciltly

is correct however

       let hub = [
            `hub.mode=subscribe`, // subscribe
            `hub.callback=https://thehighlighthub.com/SubscribeTwitch`, // this is the url where I 
                      receive the GET and POST from twitch
           `hub.lease_seconds=864000`, // 864000
           "hub.topic=https://api.twitch.tv/helix/users/follows?to_id=29795919" // stream online 
                         topic = https://api.twitch.tv/helix/streams?user_id=44322889
              ].join('&')

request(({ method: ‘POST’, json: true, url: ‘https://api.twitch.tv/helix/webhooks/hub?’ +
hub, headers: {‘Client-ID’: ‘************’,
‘Content-Type’: ‘application/json’}}),

Is not, because you say HEY I AM POSTING and then set the Content/Body to JSON and then send a JSON/body length of zero. So, HEY I AM POSTING SOME JSON IN THE BODY THE JSON IS ''

A common hiccup with API’s you do one thing and say another with your headers.

  • Content-Type - sets the type of data you are sending, in this case you sent nothing
  • Accept - sets the type of data you are expecting and/or type hints to the cURL handler what do do with the response (auto parse a JSON string to a object for example)

Hope this ramble helps :slight_smile: