Skip to content
smith edited this page Jan 7, 2018 · 11 revisions

Slack API tokens

The files.upload API method used by this script requires an access token.
image

To get started quickly you can create a legacy token for testing and development, or create a bot user and use it's token.

More details about tokens, and how to create them can be found in the Slack API documentation.

Recipients (-r) option format

Comma-separated list of channel names or IDs where the file will be shared.

Slack's channel-like IDs:
U - User / member ID (shared via IM) eg. U12345678
D - Direct Message (IM, MPDM(Multi-Party Direct Message)) eg. D12345678
C - Channel (Public) eg. C12345678
G - Group (Private Channel) eg. G12345678

Config script to set option defaults (run from slackfu root)

read -p "Enter authentication token: " TMPVAR && sed -i "3s|.*|SLACK_AUTH_TOKEN=\"$TMPVAR\"|" slackfu
read -p "Enter recipients: " TMPVAR && sed -i "4s|.*|RECIPIENTS=\"$TMPVAR\"|" slackfu
read -p "Enter file name: " TMPVAR && sed -i "5s|.*|FILENAME=\"$TMPVAR\"|" slackfu
read -p "Enter title: " TMPVAR && sed -i "6s|.*|TITLE=\"$TMPVAR\"|" slackfu
read -p "Enter footer: " TMPVAR && sed -i "7s|.*|FOOTER=\"$TMPVAR\"|" slackfu