Webhook 的 IBM Watson Assistant 请求正文

Request Body of IBM Watson Assistant for webhook

我正在使用 IBM Watson Assistant 创建一个机器人。我正在尝试使用 webhook,但不知道发送到 webhook 的 POST 请求 JSON/HTML 的格式。

我的案例研究是一家用户可以预订的商店。我想将订单详细信息发送到我的后端服务器,并为用户提供预购参考号。我在文档中没有找到关于从 IBM Watson Assistant 发送什么 POST 请求格式以及应该以什么格式返回响应的任何内容。

我知道 IBM Watson Assistant 不需要特定的响应格式。它允许开发人员根据需要操纵响应。

IBM Watson Assistant 有一个 documented API. There are the recommended V2 Assistant API which can be used to create session and then send messages. The older V1 Assistant API 功能更多,更深入的系统。这两个 API 都可以用来编写聊天机器人。

如果您指的是 Webhook as the Watson Assistant 从对话节点到外部服务的功能,过程如下:

  • 在全局配置中,你定义了URL和header
  • 对于对话节点,您启用 webhook,然后定义作为有效负载发送的键/值对。它们可以因对话节点而异。
  • 通常,预期结果是 JSON 数据,因为它最容易处理。

IBM Cloud Solution tutorial on building a Slack bot with Watson Assistant 使用 webhooks 调用 Db2 数据库。该代码在 GitHub 存储库中可用。