繁体   English   中英

从 Watson Assistant 对话框传递 Slack Native JSON 作为响应

[英]Passing Slack Native JSON from Watson Assistant Dialog as Response

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

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

我发现一篇文章说我需要使用 -

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"
        }
        ]
    }
  }
}

还通过添加引用此文档的“标题”尝试了几种组合

{
  "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? 我在这里做错了什么?

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

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

注意integrations

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM