slack-quickpost
installation
go install github.com/ToshihitoKon/slack-quickpost@latest
setup
https://api.slack.com/apps/
make Slack App and get OAuth token.
GitHub Actions
jobs:
using-slack-quikpost:
runs-on: ubuntu-latest
steps:
- uses: ToshihitoKon/slack-quickpost@v1
with:
version: 0.8.0
usage
OAuth token given by one of the following methods.
environment variable
export SLACK_TOKEN="xoxb-XXXXXXXX-XXXXXXX-XXXXXX"
slack-quickpost \
--channel [CHANNEL_ID] \
--text [TEXT]
Option
slack-quickpost \
--token xoxb-XXXXXXXX-XXXXXXX-XXXXXX \
--channel [CHANNEL_ID] \
--text [TEXT]
Config file
Save config yaml ~/.config/slack-quickpost/profile-name.yaml
token: xoxb-XXX
channel: XXX
Provide the profile name using an environment variable(SLACK_QUICKPOST_PROFILE) or option.
SLACK_QUICKPOST_PROFILE=profile-name slack-quickpost --text [TEXT]
slack-quickpost --profile profile-name --text [TEXT]
Embedded binary
Build a slack-quickpost binary with a token and default channel baked in, so
that end users can run it without providing any credentials.
Install the builder:
go install github.com/ToshihitoKon/slack-quickpost/cmd/slack-quickpost-embed@latest
Build a binary with values embedded:
# fetch the published module and embed values (default)
slack-quickpost-embed \
--token xoxb-XXXXXXXX-XXXXXXX-XXXXXX \
--channel [CHANNEL_ID] \
--output ./slack-quickpost
# token / channel can also come from environment variables
SLACK_TOKEN=xoxb-XXX SLACK_CHANNEL=[CHANNEL_ID] slack-quickpost-embed --output ./slack-quickpost
# pin the version to embed
slack-quickpost-embed --token xoxb-XXX --channel [CHANNEL_ID] --version v0.8.1
# build from the current source tree instead of the published module
slack-quickpost-embed --token xoxb-XXX --channel [CHANNEL_ID] --source local
The resulting binary uses the embedded token / channel only as a fallback.
Runtime inputs still take precedence in this order:
--token / --channel option → SLACK_TOKEN env → profile → embedded value.
Options:
--token string slack app OAuth token to embed (fallback: SLACK_TOKEN)
--channel string default slack channel id to embed (fallback: SLACK_CHANNEL)
--output string output binary path (default "slack-quickpost")
--source string build source: "module" (fetch by version) or "local" (current directory) (default "module")
--version string slack-quickpost version to build when --source=module (default "latest")
post text
slack-quickpost \
--channel [CANNEL_ID] \
--text [TEXT] \
--username [DISPLAY_USERNAME] \
--icon [ICON_EMOJI]
# text given textfile path and icon given image url
slack-quickpost \
--channel [CANNEL_ID] \
--textfile [FIlEPATH] \
--username [DISPLAY_USERNAME] \
--icon_url [ICON_IMAGE_URL]
# post text as snippet
slack-quickpost \
--channel [CANNEL_ID] \
--text [TEXT] \
--snippet
# post BlockKit
slack-quickpost \
--channel [CANNEL_ID] \
--block '{"type":"section","text":{"type":"mrkdwn","text":"*Sample BlockKit"}}'
post file
slack-quickpost \
--channel [CANNEL_ID] \
--file [FILE_PATH]
comamnd options
--blocks string post BlockKit json
--channel string post slack channel id
--file string post file path
--icon string icon emoji
--icon-url string icon image url
--nofail always return success code(0)
--profile string slack quickpost profile name
--snippet post text as snippet
--text string post text
--textfile string post text file path
--thread-ts string post under thread
--token string slack app OAuth token
--username string user name
--version print version