2017-07-17 13 views
0

在AWS控制檯中的測試機器人上,我可以輸入話語和對每個插槽的響應,AWS Lex將其選中。但在Facebook Messenger上,我已經在其中設置了響應卡及其相應的文本和值,單擊響應卡上的按鈕似乎無法到達Lex。AWS Lex無法通過按下Facebook上的響應卡按鈕來獲取用戶響應

我用lambda函數動態創建回函卡,它看起來是這樣的:

{ 
    "dialogAction": { 
    "type": "ElicitSlot", 
    "intentName": "ShopIntent", 
    "slots": { 
     "product": null, 
     "category": null 
    }, 
    "slotToElicit": "category", 
    "message": { 
     "contentType": "PlainText", 
     "content": "Choose a category." 
    }, 
    "responseCard": { 
     "contentType": "application/vnd.amazonaws.card.generic", 
     "version": 1, 
     "genericAttachments": [ 
      { 
       "title": "New", 
       "subTitle": "All the new things!", 
       "buttons": [{ 
        "text": "New", 
        "value": "1234567890" 
       }] 
      }, { 
       "title": "Shurts", 
       "subTitle": "A collection of shirts!", 
       "buttons": [{ 
        "text": "Shurts", 
        "value": "1234567891" 
       }] 
      }, { 
       "title": "Shuus", 
       "subTitle": "A collection of shoes!", 
       "buttons": [{ 
        "text": "Shuus", 
        "value": "1234567892" 
       }] 
      } 
     ] 
    } 
    } 
} 

這正確呈現了Facebook。但是在點擊按鈕時,沒有任何反應。鍵入指示符會出現幾秒鐘(比請求要長得多 - 我想知道這是否表示出現錯誤?),然後消失而沒有給出任何響應。 它甚至沒有在CloudWatch日誌中創建任何條目。我已經檢查了文檔,並且據我所知,我相信responseCard的格式是正確的。

我不知道如何調試這個問題。有沒有其他人經歷過這個?

回答

1

問題在於我沒有在我的Facebook應用程序的Messenger設置中勾選messaging_postbacks webhook。隨着和messages都被檢查,我終於可以根據需要與lex bot進行交互。