我创建了一个webhook,用于FB Checkbook Send to Messenger App。我已经创建了一个FB应用程序,其中添加了FB登录和FB Messenger产品。
我很难研究代码在哪里为多个应用创建一个webhook。
这是webhook代码。
This is the code. I need one webhook for many apps. Can someone help?
<?php
$challenge = $_REQUEST['hub_challenge'];
$verify_token = $_REQUEST['hub_verify_token'];
if ($verify_token === 'abc123abc') {
echo $challenge;
}
//$input = json_decode(file_get_contents('php://input'), true);
//error_log(print_r($input, true));
//error_log(print_r("shoaib", true));
$pageId = PAGE ID;
$access_token = "ACCESS TOKEN";
/******************************************************
To Receive Messages
*******************************************************/
$input = json_decode(file_get_contents('php://input'), true);
error_log(print_r($input, true));
$sender = $input['entry'][0]['messaging'][0]['sender']['id'];
$message = (isset($input['entry'][0]['messaging'][0]['message']['text'])) ? $input['entry'][0]['messaging'][0]['message']['text'] : '';
$postback = (isset($input['entry'][0]['messaging'][0]['postback']['payload'])) ? $input['entry'][0]['messaging'][0]['postback']['payload'] : '';
$message_to_reply = '';
//error_log(print_r($input, true));
?>