25

I'm using a webhook to post messages to Slack via PowerShell script and I'd like to include a link to a network folder. I was able to do it with

    <file://server/folder|files>

however when the generated 'files' link is clicked nothing happens. Is there a way to specify target so that a clicked link opens in a new window? If I copy the generated link and paste it into the browser, the index is rendered just fine and that would be sufficient for my purposes. Are there any alternative solutions?

Alex E
  • 735
  • 2
  • 7
  • 15
  • 4
    The most I've gotten was the ability to send links in that same format `` and then I have to right-click the link in slack and select "open link". Clicking on the links do nothing for me as well. – Nick H. Jun 16 '16 at 15:53
  • Powershell so probably Windows, what is your default browser and does it matter? Also is the behaviour any different between file: and HTTP: – eemz Feb 06 '21 at 11:21

1 Answers1

0

You may have some success with Slack's Link Buttons, which specifically open links in new browser tabs when clicked.

{
    "text": "Test Link Buttons",
    "channel": "C061EG9SL",
    "attachments": [
        {
            "fallback": "Test link button to file://server/folder",
            "actions": [
                {
                    "type": "button",
                    "name": "file_request_123456",
                    "text": "Test",
                    "url": "file://server/folder",
                    "style": "primary",
                    "confirm": "Really?"
                }
            ]
        }
    ]
}

Slack Message Builder example

Adil B
  • 14,635
  • 11
  • 60
  • 78
  • 1
    I tried this but it looks like it has the same behavior. You need to right-click the button and say "Open Link" – Will Brode Mar 14 '18 at 00:22