slackslack-apiadaptive-cardsslack-block-kit

Messageback like feature of Adaptive Card in Slack BlockKit


I am trying to implement messageBack feature of Adaptive Card in Slack Builder Kit where on clicking of a button I can show a default response of the bot before the response comes from the API. This could be implemented in Adaptive Card using messageBack. Is there a way to do similar thing in Slack Builder Kit template.

enter image description here

On clicking the button, I want to show 'Thank you for clicking' and then I want to show the response which comes from the API.


Solution

  • When the button is clicked, you can update the message that you sent with "Thank you for clicking" using the chat.update method. After that, you could update it once more to show the response from the API or just send another message via chat.postMessage.

    Alternatively, you could send an ephemeral message with the text "Thank you for clicking" using the chat.postEphemeral method, which would only show up for the user that clicked the button and then send a regular message with the API contents in a later message.