Event Sub Example Not Working

My example I moved up from webhooks and just fixed the signature logic.

So yeah theres a mistake.

Should be

        if ($headers['twitch-eventsub-message-type'] == 'webhook_callback_verification') {
            // it's a verification request
            $data = json_decode($raw_data);
            // and check the data parse
            if (json_last_error() == JSON_ERROR_NONE) {
                echo rawurlencode($data['challenge']);
                exit;
            }
            echo 'Failed to parse JSON';
            exit;
        }

I’ll update the file shortly.

I don’t use the PHP version in production :stuck_out_tongue: so it’s just an example for the sig logic.