Slack: How can I remove a message's action buttons without Slack appending “edited”

拈花ヽ惹草 提交于 2019-12-11 15:12:46

问题


I have a Slackbot message that has action buttons (see here). When a user click's a button, we perform a bit of work on our server and then use chat.update to remove the action buttons and update the message's footer:

removeButtons(reply, convo, footer) {

  const data = reply.original_message;
  delete data.attachments[0].actions;
  data.channel = reply.channel;
  if (footer) {
    data.attachments[0].footer = footer;
  }
  this.bot.api.chat.update(data, (res) => {

  });
}

Everything is working great but Slack appends an "(Edited)" to the message. I see a lot of other apps doing the same, but they seem to avoid the "(Edited)" text? What are they doing differently?

I've tried setting as_user and replace_original in the chat.update call but haven't had any luck.

Slack Screenshot


回答1:


There are two ways to "update" a message as result of an interaction.

  1. Use the API method chat.update (as you described)
  2. Respond directly to the slack request with a new message

With 2) the original message will be replaced by default and there will be no "edited" note.



来源:https://stackoverflow.com/questions/47718824/slack-how-can-i-remove-a-messages-action-buttons-without-slack-appending-edit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!