[Webhook] not receiving twitch response with challenge

Hi, I’m new here, I searched a lot in others topic but I didn’t found a answer.
I’m doing a test and using Laragon to test my application.

I built the post and receive the 202 status. But I don’t receive the call from twitch with the challenge code.

This is the post code:

route::get(’/testeSubscribe’, function () {

$post = '{"hub.mode":"subscribe",
            "hub.topic":"https://api.twitch.tv/helix/users/follows?to_id=121059319",
            "hub.callback":"http://localhost/webhook",
            "hub.lease_seconds":"864000"}';
$authorization = "Client-ID: mycode";
$ch = curl_init('https://api.twitch.tv/helix/webhooks/hub');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $authorization));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result);

});

Route::get(’/webhook’, function () {
echo $_GET[‘hub_challenge’];
Log::debug($_GET[‘hub_challenge’]);
});

It’s a really simple code just to test,

Thank you for your time.

You can’t use localhost as a callback, otherwise when Twitch attempts to send the challenge they’ll just be sending it to themselves.

You have to use a callback that is internet accessible.

thanks @Dist

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