Petran
Petran

Reputation: 8047

Create a link button with slack blocks api

I want to have a slack button that will behave as a link, it will send user to my website when it clicked. Is that possible with slack new api?

Upvotes: 4

Views: 6787

Answers (1)

stud3nt
stud3nt

Reputation: 2143

Yes, it is possible by using block kit. All you have to do is add a button inside actions and provide the url. On click it will redirect to https://google.com and also sends a request to slack api.

Block Kit Code:

{
    "blocks": [
        {
            "type": "actions",
            "elements": [
                {
                    "type": "button",
                    "text": {
                        "type": "plain_text",
                        "emoji": true,
                        "text": "Click me"

                    },
                    "style": "primary",
                    "value": "click_me",
                    "url":  "https://google.com"
                }
            ]
        }
    ]
}

Output:
Link Button

Upvotes: 12

Related Questions