Search code examples
pythonplistslackslack-apislack-commands

How to send ad-hoc app download link itms-service on slack using message buttons or link


I have a slack /Slash command that generates the app file link. I want to send that link to a user as a button or link but it has to be prefixed with:

itms-services://?action=download-manifest&url={download_link}

Currently slack is not recognizing this as a valid link but it's mandatory by iOS because of permission issues.

Basically I want to mimic the download button on web on slack so user is not required to visit the website.

On Web this link itms-services://?action=download-manifest&url={download_link} works fine and user is asked to authorize the download.

enter image description here

test_attachment = [
    {
        "color": "#CC0000",
        "actions": [
            {
                "type": "button",
                "text": ":red_circle:   Download Link:",
                "url": "itms-services://?action=download-manifest&url={download_link}"
            }
        ]
    }
]

slack_client.api_call("chat.postMessage", channel=channel_id, text=text, attachments=json.dumps(test_attachment))

Another example:

<a href="itms-services://?action=download-manifest&url=http://loqi.me/app/Geoloqi.plist">
  Download Geoloqi
</a>

This will work on Web and how to make it work on slack messages.


Solution

  • I had a similar problem in one of my apps where I wanted to provide a download button for a dynamically generated image file.

    As far as I know there is no switch or option in Slack that allows you to do this, so your only option is to use a helper web app.

    The approach would be:

    1. User clicks a link button on Slack that opens your helper web app in the browser
    2. Helper web app performs the actual download (no further user interaction required)

    My guess is the user will need to authenticate in the browser anyways, so this should not create any inconvenience for the user. But of course you would need to provide the additional web helper app.