Search code examples
chatbotslackslack-api

Slack - chatbot dialog with button


In slack is possible to use attachments to create buttons in a chat (https://api.slack.com/docs/message-buttons).

How can I click in the button and use the text button in chat? Don't use link or redirect, just use the button text in the chat.


Solution

  • As I understand you want to update your chat message after a user clicks the button.

    Here is how this would work with Slack:

    1. Your app post a message with a message button in a channel
    2. User clicks on button
    3. Your app gets interaction request from Slack
    4. Your apps replies to the Slack request to update the message content (e.g. text) by replacing it with a new message.

    This is how this works with Slack and its the only approach. See also this answer on the same topic.