Facebook Messenger Webhook 未验证

Facebook messenger webhook not verifying

我正在测试 facebook Messenger webhook, 注册我已经设置了必要的参数 这是我的 php 代码,

代码:

$postData = request()->all();

        // Your verify token. Should be a random string.
        $verfityTocken = "fR8Eu5Wj9m9WTLvA0vIZYMenoTvu51bdGaL70FFb9pHhSeySbLHa0Q5cTLaJ";

        // Parse the query params
        $mode = $postData['hub_mode'];
        $token = $postData['hub_verify_token'];
        $challenge = $postData['hub_challenge'];

        // Checks if a token and mode is in the query string of the request
        if ($mode && $token) {

            // Checks the mode and token sent is correct
            if ($mode === 'subscribe' && $token === $verfityTocken) {

                // Responds with the challenge token from the request
                //echo 'WEBHOOK_VERIFIED';

                return response(request()->input("hub_challenge"), 200);

            } else {
                // Responds with '403 Forbidden' if verify tokens do not match
                return response('403 Forbidden', 403);
            }
        }

现在从 Messanger 面板验证 webhook,我收到如图所示的错误

我不明白为什么接收到的数据有尾随数据\u0033Clink

对于仍在尝试解决此问题的任何人,您需要 return 纯文本形式的 hub_challenge 号码。

我在 ruby 中是这样做的:

def accept_request

    render plain: params['hub.challenge']
end