Michael Mattax
Michael Mattax

Reputation: 21

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

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

Upvotes: 2

Views: 5839

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32852

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.

Upvotes: 3

Related Questions