0
api.ai 통합으로 Facebook 메신저 봇을 만들고 있습니다. 내 api.ai 에이전트가 webhook-api.php에 연결되어 있습니다. 이제는 내 웹 훅을 통해 버튼 응답 (서식이 지정된 메시지)을 봇에 보내려고합니다. 나는이 문서 다음 - https://docs.api.ai/docs/webhookFacebook 메신저 봇에서 응답 버튼으로 보내기 버튼을 표시하는 중 오류가 발생했습니다.
을 그리고 api.php에 이런 짓을하지만
<?php
header('Content-Type: application/json');
ob_start();
$json = file_get_contents('php://input');
$request = json_decode($json, true);
$action = $request["result"]["action"];
$parameters = $request["result"]["parameters"];
$data =json_encode([
'speech' => "test",
'displayText' => "test",
'data' => "{
'facebook': {
'recipient':{
'id':'USER_ID'
},
'message':{
'attachment':{
'type':'template',
'payload':{
'template_type':'button',
'text':'What do you want to do next?',
'buttons':[
{
'type':'web_url',
'url':'https://petersapparel.parseapp.com',
'title':'Show Website'
},
{
'type':'postback',
'title':'Start Chatting',
'payload':'USER_DEFINED_PAYLOAD'
}
]
}
}
}
}
}
}",
'source' => "source"
]);
echo $data;
?>
감사합니다 버튼을 표시하지 않습니다.
실제로 의미하는 것은 무엇입니까? 메시지가 전혀 전달되지 않는 것입니까? 문제가 있다면 스택 추적을 게시 할 수 있습니까? – akinmail