# Got no requests of twitch webhook after subscription

**URL:** <https://discuss.dev.twitch.com/t/got-no-requests-of-twitch-webhook-after-subscription/14993>\
**Category:** API\
**Created:** [March 30, 2018, 11:39am UTC](https://discuss.dev.twitch.com/t/got-no-requests-of-twitch-webhook-after-subscription/14993 "2018-03-30T11:39:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hanashi](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/hanashi/32/4341_2.png) [@Hanashi](https://discuss.dev.twitch.com/u/Hanashi)\
**Post date:** [March 30, 2018, 11:39am UTC](https://discuss.dev.twitch.com/t/got-no-requests-of-twitch-webhook-after-subscription/14993/1 "2018-03-30T11:39:29Z")

</div>

Hello,

I would like to use the webhook for to show if a user is live.

I executed this code (replaced own data):  
$data = array(  
‘hub.callback’ =\> ‘[https://myurl/twitch/webhook\_redirect.php](https://myurl/twitch/webhook_redirect.php)’,  
‘hub.mode’ =\> ‘subscribe’,  
‘hub.topic’ =\> ‘[https://api.twitch.tv/helix/streams?user\_id=147837668](https://api.twitch.tv/helix/streams?user_id=147837668)’,  
‘hub.lease\_seconds’ =\> 864000  
);  
$dataString = json\_encode($data);

```
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.twitch.tv/helix/webhooks/hub");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	'Client-ID: myclientid',
	'Content-Type: application/json',
	'Content-Length: ' . strlen($dataString)
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec ($ch);
$info = curl_getinfo($ch);

curl_close ($ch);

print_r($server_output);
print_r($info);

```

I got the response code 202 and my webhook\_redirect.php was requested and I got the hub\_challenge “C5JUIAPXHt2OogUeP8oXv8uXhoZ\_BCq5vj9XUPaN”.  
But if I go live with the user, my script got no request of twitch. This is my webhook\_redirect.php:  
\<?php  
file\_put\_contents(“get.txt”, json\_encode($\_GET)."\n", FILE\_APPEND);  
file\_put\_contents(“post.txt”, json\_encode($\_POST)."\n", FILE\_APPEND);  
file\_put\_contents(“request.txt”, json\_encode($\_REQUEST)."\n", FILE\_APPEND);  
$request\_body = file\_get\_contents(‘php://input’);  
file\_put\_contents(“json.txt”, $request\_body."\n", FILE\_APPEND);

In the files are no new entries for requests from twitch.  
How can I fix this or is it a twitch bug?

kind regards  
Hanashi

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [March 30, 2018, 11:49am UTC](https://discuss.dev.twitch.com/t/got-no-requests-of-twitch-webhook-after-subscription/14993/2 "2018-03-30T11:49:14Z")

</div>

Did you see the incoming post request from Twitch in your web server access logs?

Did you see an error in your incoming server error logs?

Did you reply to the incoming hub\_challenge with the hub\_challenge?

```
<?php

    if ($_GET['hub_challenge']) {
        echo $_GET['hub_challenge'];
        exit;
    }
```

---

<div class="post-metadata">

**Author:** ![Hanashi](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/hanashi/32/4341_2.png) [@Hanashi](https://discuss.dev.twitch.com/u/Hanashi)\
**Post date:** [March 30, 2018, 12:00pm UTC](https://discuss.dev.twitch.com/t/got-no-requests-of-twitch-webhook-after-subscription/14993/3 "2018-03-30T12:00:34Z")

</div>

I added now the script snippet from you to webhook\_redirect.php und resubscribed (unsubsribe and subscribe) to the webhook, but I have the same problem.

There is no entry in my error.log or acces.log of my webserver for a request from twitch after subscribing. There is only a entry of the subscription request.

Edit: It’s magical. Now it works. Thanks for help.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [March 30, 2018, 1:01pm UTC](https://discuss.dev.twitch.com/t/got-no-requests-of-twitch-webhook-after-subscription/14993/4 "2018-03-30T13:01:59Z")

</div>

On a side note:

There is on average a 3 minute delay from video start for the up webhook and a 6 minute delay from video end for the down

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [April 29, 2018, 1:02pm UTC](https://discuss.dev.twitch.com/t/got-no-requests-of-twitch-webhook-after-subscription/14993/5 "2018-04-29T13:02:07Z")

</div>

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