Search code examples
slackslack-block-kit

Can you use slack buttons non-interactively?


While using Slack's block kit builder, I created a message that would send a notification as well as a link for the user to click on. I like the way the default button looks, but I get a warning whenever I click it saying my app isn't configured for interactivity.

enter image description here

The link does work, but the warning icon is unsettling. Is there a way to use these buttons without expecting interactivity? The alternative seems to be to just use a markdown link, but I don't think it looks as nice.

My block:

{
    "blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "Hello here's a notification"
            }
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "<https://google.com|View Conversation>"
            }
        }
    ]
}

If I send this block straight from the block kit builder there's no warning message. I'm guessing this is because it gets sent as my user as opposed to an app.


Solution

  • As of now, there is no way to set up a block kit button without interactivity. i.e., when someone clicks on the button (with or without a URL), Slack sends a request to the preconfigured URL in your app config. The app needs to acknowledge this request and send an HTTP 200 OK response, in order for the button URL to work without the error sign.

    You can read a rather detailed discussion on Slack's GitHub here.

    A workaround, for now, would be to set up a webhook URL somewhere on the web (google cloud run could be a good free solution) which returns an acknowledge response. You can then alter your app's config to use this URL for app interactivity.

    p.s. When you use block kit builder to send a preview message to Slack, it uses the same user token as the one used by Slack web app. The behavior you noted above can't be replicated when you use any other user token (received from an app's install flow).