Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open URL in browser from Message Button using Slack API

I am sending the users a slack message with a button through a Slack App. On every click of the button, I generate a new URL.

At the moment, I am able to return the URL back as a message. The user clicks on the message to open the URL in the browser.

Instead of the sending a message back, I want to open the URL directly in the browser using slack API.

How can I accomplish it? I can't seem to find anything in the documentation that does that.

Thanks

PS: Google Drive integration does that already.

like image 206
nithishr Avatar asked Nov 03 '16 14:11

nithishr


People also ask

What is redirect URL in Slack?

The redirect_uri is where Slack will send the user back to, along with the temporary authorization code, once the user okays your app. Alternatively, you can configure a Redirect URL in the App Management page under OAuth & Permissions.


1 Answers

It appears Slack introduced this feature recently.

As documented in https://api.slack.com/docs/message-attachments#link_buttons

  "actions": [
    {
      "type": "button",
      "text": "Book flights 🛫",
      "url": "https://flights.example.com/book/r123456"
    }

It's possible to preview in Slack's interactive message builder

like image 63
Daniel Avatar answered Sep 21 '22 13:09

Daniel