How to show Rich Response Buttons (''Chips) Using Dialogflow Fulfillment?

為{幸葍}努か 提交于 2021-02-05 10:43:05

问题


Based on the online example I wanted to try to add Rich Response Buttons and Basic cards using Dialogflow Fulfillment and Inline editor, but I'm not getting anything rendered in the Dialogflow Messenger client. Are rich responses not fully supported?


回答1:


According to the readme file, the Dialogflow Fulfillment library is no longer being maintained; therefore, it seems that you can't use rich response in Dialogflow messenger directly with this library.

Based on this, if you want to use rich responses with Dialogflow messenger, you can create a webhook service. To start testing this, I recommend you do the following:

1- Use Cloud Functions to create an HTTP function. This documentation mentions the process to create one from the Cloud Console. Please take in account this considerations in the second step:

  • Runtime: Python 3.8
  • Entry point: entry_function
  • Inside the inline editor, copy and paste the following code:
from flask import jsonify
 
def entry_function(request):
 
   response_json = jsonify(
       fulfillment_text="This message is from Dialogflow's testing!",
       fulfillment_messages=[
           {
               "payload": {
                   "richContent": [[{
                       "actionLink": "https://assistant.google.com/",
                       "subtitle": "This is the body text of a card.  You can even use line\n  breaks and emoji! 💁",
                       "title": "Title: this is a card title",
                       "type": "info"
                   }]]
               }
           }
       ]
   )
   return response_json

Deploy the function. Afther that, enter to your function and in the 'TRIGGER' section copy the Trigger URL

2- Enable and manage fulfillment in Dialogflow

3- Test your Dialogflow messenger.



来源:https://stackoverflow.com/questions/64234039/how-to-show-rich-response-buttons-chips-using-dialogflow-fulfillment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!