2016-10-16 4 views
1

を持っていませんクイック返信ボタンのペイロード(event.message.quick_reply)、それは未定義だと言います。しかし、他のフィールドの場合は、「seq」フィールドや「text」フィールドのように返されます。 私は間違っていますか、どのように素早い返信ボタンのペイロードを使用できますか?クイック返信は私がFacebookのメッセンジャーボット(JavaScriptの)における迅速な返信ボタンにこのコードを使用していたペイロード

答えて

1

以下のコードユーザーが送信/クリックしたすべてのものを取得する方法を示します。

// handle bot's anwser 
$input = json_decode(file_get_contents('php://input'), true); 
$senderId = $input['entry'][0]['messaging'][0]['sender']['id']; 

// gets the text the user sent to you 
$messageText = $input['entry'][0]['messaging'][0]['message']['text']; 

// gets the payload of the button 
$buttonPayLoad = $input['entry'][0]['messaging'][0]['postback']['payload']; 

// gets the payload of the quick replay 
$quickReplyPayLoad = $input['entry'][0]['messaging'][0]['message']['quick_reply']['payload']; 
関連する問題