How to distribute APK to Slack Automatically.

Lee young-jun
3 min readSep 12, 2021

--

olulo’s APK has been distributed at Slack for QA.
To distribute it, Github workflows was uploading APK to AWS and linked it into Slack message.
So I registered back log to upload directly long time ago and I resolved it yesterday.

Today I will share how to do.

First, I searched there is workflow to achieve it.
And Found out this workflow slack-file-upload-action

Let’s see

Version

If you tag as app version, you can get the tag like this

${GITHUB_REF/refs\/tags\//}

And you can export it to use in another step

echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

Token

We need a slack token to use MeilCli/slack-upload-file@v1

Creates Slack App

https://api.slack.com -Create an app
Select [From scratch]
Input your Slack App name and Select your space

copy it and paste to “slack_token”

slack_token: xx

Grants permission

To use this token, you have to grant the file write permission.

Bot

Bot user needs to upload APK.

Creates Bot

Set your Bot name

Install App to Workspace

Install App to Target Channel

To upload file by Bot, the Bot have to join to target Channel.
But Bot is not user and we can’t invite him.
So we have to install Bot to target Channel.

See your target channel’s integration

Slack Channel Integration
Search your app
Bot Joined your channel

Channel

channels: {your channel name}

File

file_path: {Path of file to upload}
file_name: {New file name to use upload}
file_type: ‘apk’

Message

initial_comment: {Chat message to present with uploaded file}

Unfortunately we can’t mention others with this message.
Because Slack’s file.upload api doesn’t support link_names

Title

title: {Title to present instead of uploaded file name}

Workflow

you can now distribute APK to Slack with this Github workflow

--

--

No responses yet