我想在我用Python开发的Dialogflow webhook中创建卡片。我知道如何在内联编辑器中执行此操作:
agent.add(new Card({
title: '*How has the COVID-19 crisis :mask:*',
text: 'impacted the stability of your life?',
})
);
agent.add(new Suggestion("1 :cold_sweat: *more exasperated and hopeless*"));
agent.add(new Suggestion("2 :expressionless: *less freaked out than other people*"));
agent.add(new Suggestion("3 :relieved: *More calm and hopeful*"));
agent.add(new Suggestion("4 :fearful: *More scared and panicked*"));
agent.add(new Suggestion("5 :smiley: *More surprised and baffled*"));然而,当我使用自己设计的webhook时,我不得不禁止内联编辑器。我不知道如何创建带有按钮消息的相同卡片,以便在自己设计的网站上使用它,无论是从我的Flask应用程序的Post request应用程序中创建,还是使用自定义有效负载选项。
如何从客户负载创建卡片或从post请求创建应用程序?
我的网站是基于this repository的
发布于 2020-05-20 00:00:38
我会看看pydialogflow-fulfillment模块:它与Flask一起工作,并提供了一个开发工具包来创建主要的响应类型(文本响应,建议的操作):
dialogflow_response.add(Suggestions(["Option 1","Option 2","Option 3"]))在GitHub上查看烧瓶示例
https://stackoverflow.com/questions/61877847
复制相似问题