【问题标题】:Passing Slack Native JSON from Watson Assistant Dialog as Response从 Watson Assistant 对话框传递 Slack Native JSON 作为响应
【发布时间】:2020-05-06 08:00:27
【问题描述】:

我已使用 Slack Integration 将 Watson Assistant 与 Slack App 集成。

现在,我正在尝试使用 JSON 编辑器通过 Watson Dialog 推送 Slack 支持的原生 JSON。

我找到了一个article,上面写着我需要使用 -

output.slack: insert any JSON you want to be included in the attachment field of the Slack.

所以,我尝试使用以下作为响应,

{
  "output": {
    "slack": {
      "text": "Choose an action"
    }
  }
}

{
  "output": {
    "slack": {
      "attachments":[
        {
          "text": "Choose an action"
        }
        ]
    }
  }
}

还通过添加引用 this document 的“标题”尝试了几种组合

{
  "output": {
    "slack": [{
      "title" : "Test Title",
      "text" :[
      {
        "value": "Hello"
      }
        ]
    }]
  }
}

{
  "output": {
    "slack": {
      "title" : "Test Title",
      "text" : "Hello"
      }
  }
}

{
  "output": {
    "slack": {
      "attachments": 
        {
          "title" : "Test Title",
          "text" : "Hello"
        }

      }
  }
}

但 Slack 没有检测到它,也没有显示任何内容。

我已经在 Slack 上为我的应用启用了交互功能。

有没有人能够通过 Watson Dialog 将 Native JSON 传递给 slack?我在这里做错了什么?

【问题讨论】:

  • 基于 Watson Assistant 文档,Slack 消息需要标题:cloud.ibm.com/docs/…您是否尝试过不只是发送“文本”?
  • @data_henrik 你的意思是除了“文本”之外,我们还需要传递“标题”?我只是尝试了它和几种组合,但无法让它发挥作用。
  • @data_henrik 更新了问题中的一些尝试。

标签: ibm-watson slack slack-api watson-assistant slack-dialog


【解决方案1】:

您应该将您的 webhook 更新到 2020 年 4 月之后的版本。 然后做

{
  "output": {
    "integrations": {
      "slack": [{
        "title" : "Test Title",
        "text" :[
        {
          "value": "Hello"
         }
       ]
    }]
  }
}
}

注意integrations

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-27
    • 1970-01-01
    • 2021-04-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多