松弛不提供交互时的原始消息

时间:2018-06-25 21:32:31

标签: slack slack-api

我正在使用此JSON响应传入的Slack斜杠命令(收据后不是POST):

{
  "text": "Testing some interactions!",
  "attachments": [{
    "callback_id": "testing_interactions",
    "attachment_type": "default",
    "actions": [{
      "name": "action",
      "text": "Click Me",
      "value": "clicked",
      "style": "primary",
      "type": "button"
    }]
  }]
}

这给了我一个漂亮,漂亮,绿色的按钮,在大多数情况下,一切似乎都很好。但是,根据the Slack documentation for Interactive Messages,我应该在交互有效负载中获得一个original_message属性。

这不会发生,我只会得到带有有效负载的示例POST:

{
  "type": "interactive_message",
  "actions": [
    {
      "name": "action",
      "type": "button",
      "value": "clicked"
    }
  ],
  "callback_id": "testing_interactions",
  "team": {
    "id": "TEAMID",
    "domain": "mydomain"
  },
  "channel": {
    "id": "CHANNELID",
    "name": "directmessage"
  },
  "user": {
    "id": "USERID",
    "name": "me"
  },
  "action_ts": "123456",
  "message_ts": "123456",
  "attachment_id": "1",
  "token": "my_token",
  "is_app_unfurl": false,
  "response_url": "https://hooks.slack.com/actions/...",
  "trigger_id": "some.id"
}

我希望能够使用original_message属性在我的目标实现中提供批准/取消操作,但是无法这样做。

有两个问题:

  • 在互动中发回original_message时我想念什么?
  • 这似乎是错误的,但是是否需要保留原始数据以便轻松地重新创建消息?

1 个答案:

答案 0 :(得分:4)

您的互动消息是否短暂? From the docsThe original_message is not provided for ephemeral messages.