如何将 Dialogflow 的实现代码与 Kommunicate 一起使用

How to use Dialogflow's fulfillment code with Kommunicate

抱歉,如果这个问题很愚蠢,但我还没有太多使用 Javascript 或 Dialogflow 的经验。我有一个 Dialogflow 机器人,我已通过 Kommunicate 将其集成到测试网站中。该机器人使用通过意图设置的响应,但履行代码似乎不是 运行,因为通过履行设置的任何响应都不会发生。实现是通过内联编辑器编码的。

以下是通过意图设置的一些响应:

这是通过履行设置的回复:

在这里,您可以看到通过 Dialogflow 控制台运行的履行响应:

最后,在这里您可以看到它不能通过 Kommunicate 工作,但意图响应可以:

我很确定我的问题是履行代码不在 Kommunicate 上 运行ning,需要以某种我不知道的方式集成到 Kommunicate 中。有人知道我需要做什么吗?

编辑:我可能已经找到原因了。在履行文档的底部,它是这样说的:"Network calls originating from your Cloud Function for Firebase to destinations outside Google's network require billing to be enabled for the underlying Google Cloud or Firebase project."在我试图说服我的老板花钱之前,有人能确认这是我需要做的吗?

您无需启用计费即可使用 Dialogflow。 Dialogflow 附带 Free Edition,您可以在不启用计费的情况下开发和测试机器人。

Kommunicate 支持 Dialogflow 的默认响应以及自定义 webhook。直接使用默认响应。在 Custom Payload 中输入 kommunicate 支持的文本回复或任何 Actionable message,Kommunicate 将自动在聊天 UI.

中呈现它

如果您为 Intent 启用了 webhook 调用,您可以使用 fulfillmentText 字段到 return 文本消息数组或 fulfillmentMessages 字段到 return 可操作消息作为Dialogflow docs.

中描述

Kommunicate 使用这些字段来确定将在 UI 中显示的消息。如果两个字段都存在,则 Both 将在 UI 中呈现。这是您的 webhook 响应的示例:

{
    "fulfillmentText": "render a text message from webhook",
    "fulfillmentMessages": [{
      // message 1 (optional)- render actionable message 
        "payload": {
            "message": "render a Actionable message from webhook",
            "platform": "kommunicate",
            "metadata": {
                // replace this with metadata JSON supported by kommunicate 
            }
        }
    }, {
      // message 2 (optional)- render a text message  
        "text": {
            "text": ["render array of  text message from webhook"]
        }
    }]
}

此 JSON 将在 UI 上呈现消息。您可以根据需要自定义此设置。这里有更多关于 dialogflow fulfilment with kommunicate 的信息。

如果您仍然无法正常工作,请发送您的问题至 hello@kommunicate.io

PS:我为 Kommunicate 工作。