# EventSub webhook callback verification failed. Help me =(

**URL:** <https://discuss.dev.twitch.com/t/eventsub-webhook-callback-verification-failed-help-me/42897>\
**Category:** API\
**Created:** [January 18, 2023, 9:42pm UTC](https://discuss.dev.twitch.com/t/eventsub-webhook-callback-verification-failed-help-me/42897 "2023-01-18T21:42:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tagged\_play](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/tagged_play/32/21978_2.png) [@tagged\_play](https://discuss.dev.twitch.com/u/tagged_play)\
**Post date:** [January 18, 2023, 9:42pm UTC](https://discuss.dev.twitch.com/t/eventsub-webhook-callback-verification-failed-help-me/42897/1 "2023-01-18T21:42:45Z")

</div>

Please help me.  
I’m trying to set up a callback to subscribe to EventSub.  
I am using framework yii2 (PHP).  
What am I doing wrong?

I test my callback and get the following:

> **Summary**
>
> ```auto
> PS C:\Users\ma110y> twitch event trigger update-redemption -F https://tagged-play.ru/twitch-callback -s c3eb4dc7c6da0ad20397fbaa244a04446c76e9d3df71b7c99fd1057b7102729c
> ✔ Request Sent. Received Status Code: 200
> ✔ Server Said: null
> {"subscription":{"id":"137d104b-68eb-b00c-e322-b8961900cc41","status":"enabled","type":"channel.channel_points_custom_reward_redemption.update","version":"1","condition":{"broadcaster_user_id":"17390441"},"transport":{"method":"webhook","callback":"null"},"created_at":"2023-01-18T21:28:25.1561829Z","cost":0},"event":{"id":"137d104b-68eb-b00c-e322-b8961900cc41","broadcaster_user_id":"17390441","broadcaster_user_login":"testBroadcaster","broadcaster_user_name":"testBroadcaster","user_id":"40725345","user_login":"testFromUser","user_name":"testFromUser","user_input":"Test Input From CLI","status":"unfulfilled","reward":{"id":"8eca1920-3776-eb6c-dbda-61d044f67e09","title":"Test Reward from CLI","cost":150,"prompt":"Redeem Your Test Reward from CLI"},"redeemed_at":"2023-01-18T21:28:25.1561829Z"}}
> PS C:\Users\ma110y>
> 
> ```

On my site I see fallowing:

> **Summary**
>
> ```auto
> 
> [event] => stdClass Object
> (
> [id] => 137d104b-68eb-b00c-e322-b8961900cc41
> [broadcaster_user_id] => 17390441
> [broadcaster_user_login] => testBroadcaster
> [broadcaster_user_name] => testBroadcaster
> [user_id] => 40725345
> [user_login] => testFromUser
> [user_name] => testFromUser
> [user_input] => Test Input From CLI
> [status] => unfulfilled
> [reward] => stdClass Object
> (
> [id] => 8eca1920-3776-eb6c-dbda-61d044f67e09
> [title] => Test Reward from CLI
> [cost] => 150
> [prompt] => Redeem Your Test Reward from CLI
> )
> 
> [redeemed_at] => 2023-01-18T21:28:25.1561829Z
> )
> 
> ```

Next, I register a webhook and get the following:

> **Summary**
>
> ```auto
> array(4) {                                                                                                                                                                                                                                                                                                                 
> ["data"]=>                                                                                                                                                                                                                                                                                                               
> array(1) {                                                                                                                                                                                                                                                                                                               
> [0]=>                                                                                                                                                                                                                                                                                                                  
> array(8) {                                                                                                                                                                                                                                                                                                             
> ["id"]=>                                                                                                                                                                                                                                                                                                             
> string(36) "90e92aed-b2d2-4b88-963d-19e564a56df1"                                                                                                                                                                                                                                                                    
> ["status"]=>                                                                                                                                                                                                                                                                                                         
> string(37) "webhook_callback_verification_pending"                                                                                                                                                                                                                                                                   
> ["type"]=>                                                                                                                                                                                                                                                                                                           
> string(14) "channel.update"                                                                                                                                                                                                                                                                                          
> ["version"]=>                                                                                                                                                                                                                                                                                                        
> string(1) "1"                                                                                                                                                                                                                                                                                                        
> ["condition"]=>                                                                                                                                                                                                                                                                                                      
> array(1) {                                                                                                                                                                                                                                                                                                           
> ["broadcaster_user_id"]=>                                                                                                                                                                                                                                                                                          
> string(9) "798748369"                                                                                                                                                                                                                                                                                              
> }                                                                                                                                                                                                                                                                                                                    
> ["created_at"]=>                                                                                                                                                                                                                                                                                                     
> string(30) "2023-01-18T21:21:40.969961007Z"                                                                                                                                                                                                                                                                          
> ["transport"]=>                                                                                                                                                                                                                                                                                                      
> array(2) {                                                                                                                                                                                                                                                                                                           
> ["method"]=>                                                                                                                                                                                                                                                                                                       
> string(7) "webhook"                                                                                                                                                                                                                                                                                                
> ["callback"]=>                                                                                                                                                                                                                                                                                                     
> string(38) "https://tagged-play.ru/twitch-callback"                                                                                                                                                                                                                                                                
> }                                                                                                                                                                                                                                                                                                                    
> ["cost"]=>                                                                                                                                                                                                                                                                                                           
> int(0)                                                                                                                                                                                                                                                                                                               
> }                                                                                                                                                                                                                                                                                                                      
> }                                                                                                                                                                                                                                                                                                                        
> ["total"]=>                                                                                                                                                                                                                                                                                                              
> int(1)                                                                                                                                                                                                                                                                                                                   
> ["max_total_cost"]=>                                                                                                                                                                                                                                                                                                     
> int(10000)                                                                                                                                                                                                                                                                                                               
> ["total_cost"]=>                                                                                                                                                                                                                                                                                                         
> int(0)                                                                                                                                                                                                                                                                                                                   
> }      
> 
> ```

on my server i see this:

> **Summary**
>
> ```auto
> stdClass Object
> (
> [subscription] => stdClass Object
> (
> [id] => 90e92aed-b2d2-4b88-963d-19e564a56df1
> [status] => webhook_callback_verification_pending
> [type] => channel.update
> [version] => 1
> [condition] => stdClass Object
> (
> [broadcaster_user_id] => 798748369
> )
> 
> [transport] => stdClass Object
> (
> [method] => webhook
> [callback] => https://tagged-play.ru/twitch-callback
> )
> 
> [created_at] => 2023-01-18T21:21:40.969961007Z
> [cost] => 0
> )
> 
> [challenge] => 7oju4NLCrEwRNYgHNVAzYXf_brHJR4J5iNDaiHZI2Qs
> )
> 
> ```

But when I send /helix/eventsub/subscriptions, I get webhook\_callback\_verification\_failed

> **Summary**
>
> ```auto
> {
> "total": 1,
> "data": [
> {
> "id": "90e92aed-b2d2-4b88-963d-19e564a56df1",
> "status": "webhook_callback_verification_failed",
> "type": "channel.update",
> "version": "1",
> "condition": {
> "broadcaster_user_id": "798748369"
> },
> "created_at": "2023-01-18T21:21:40.969961007Z",
> "transport": {
> "method": "webhook",
> "callback": "https://tagged-play.ru/twitch-callback"
> },
> "cost": 0
> }
> ],
> "max_total_cost": 10000,
> "total_cost": 0,
> "pagination": {}
> }
> 
> ```

My code:

> **Summary**
>
> ```auto
> public function actionIndex()
> {
> \Yii::$app->response->format = Response::FORMAT_JSON;
> \Yii::$app->response->statusCode = 200;
> 
> $folder = \Yii::getAlias('@app/runtime/');
> 
> file_put_contents($folder . '/payload.txt', file_get_contents('php://input'), FILE_APPEND);
> 
> $incoming_payload = json_decode(file_get_contents('php://input'));
> 
> file_put_contents($folder . '/payload_json.txt', '<pre>' . print_r($incoming_payload, true). '</pre>', FILE_APPEND);
> 
> $headers = '<pre>' . print_r(getallheaders(), true) . '</pre>';
> 
> file_put_contents($folder. '/' .time() . '_HEADERS.txt', $headers);
> 
> if(isset($_GET) && !empty($_GET)) {
> $get = '<pre>' . print_r($_GET, true) . '</pre>';
> file_put_contents($folder. '/' .time() . '_GET.txt', $get);
> }
> if(isset($_POST) && !empty($_POST)){
> $post = '<pre>' . print_r($_POST, true) . '</pre>';
> file_put_contents($folder. '/' .time() . '_POST.txt', $post);
> }
> }
> 
> ```

Callback link - [https://tagged-play.ru/twitch-callback](https://tagged-play.ru/twitch-callback)  
I return 200 code as required by the documentation and do not output/send anything in response.  
I have an ssl certificate and port 443 is available. What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [January 19, 2023, 12:00am UTC](https://discuss.dev.twitch.com/t/eventsub-webhook-callback-verification-failed-help-me/42897/2 "2023-01-19T00:00:27Z")

</div>

I don’t see you responding to the challenge anywhere. When you subscribe to an EventSub over webhooks, Twitch will send you a challenge, as you can see in one of your summaries `[challenge] => 7oju4NLCrEwRNYgHNVAzYXf_brHJR4J5iNDaiHZI2Qs`

When Twitch sends that to you, you need to respond with a 200 status AND that challenge, which in that case would be `7oju4NLCrEwRNYgHNVAzYXf_brHJR4J5iNDaiHZI2Qs`. If your server doesn’t send that challenge back, it fails the verification process.

---

<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:** [January 19, 2023, 12:12am UTC](https://discuss.dev.twitch.com/t/eventsub-webhook-callback-verification-failed-help-me/42897/3 "2023-01-19T00:12:48Z")

</div>

You can also use the TwitchCLI to test your Callback

I did so and the result is

```auto
twitch event verify-subscription cheer -F https://tagged-play.ru/twitch-callback
✗ Invalid response. Received null as body, expected 0f4f2e05-42b1-e6a7-4e2e-ebbf7e7c8aad
✗ Invalid content-type header. Received type application/json with charset UTF-8. Expecting text/plain.
✔ Valid status code. Received status 200

```

Which as you can see is incorrect as you don’t echo back the challenge as dist notes

---

<div class="post-metadata">

**Author:** ![tagged\_play](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/tagged_play/32/21978_2.png) [@tagged\_play](https://discuss.dev.twitch.com/u/tagged_play)\
**Post date:** [January 20, 2023, 4:31pm UTC](https://discuss.dev.twitch.com/t/eventsub-webhook-callback-verification-failed-help-me/42897/4 "2023-01-20T16:31:36Z")

</div>

Thanks a lot. I succeeded =)

---

<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:** [February 19, 2023, 4:32pm UTC](https://discuss.dev.twitch.com/t/eventsub-webhook-callback-verification-failed-help-me/42897/5 "2023-02-19T16:32:08Z")

</div>

Closed on February 19, 2023, 4:32pm UTC

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