GitHub Actions slackapi/slack-github-action "invalid_auth"
slack-github-action supports several techniques (bot token, webhook, incoming webhook). The bot-token technique calls the Slack Web API, which returns invalid_auth when the SLACK_BOT_TOKEN is empty, wrong, or not scoped for the method.
What this error means
A slack-github-action step fails with the Slack API error invalid_auth when posting a message.
github-actions
Error: An API error occurred: invalid_auth
Error: The request to the Slack API failed.Common causes
Missing or wrong bot token
SLACK_BOT_TOKEN unset, mismatched, or unavailable on the trigger resolves to an invalid credential.
Technique/credential mismatch
Using the bot-token technique while only a webhook URL is configured (or vice versa) fails auth.
How to fix it
Match the technique to a valid credential
- For chat.postMessage, set the bot token via the env and the channel-id input.
- For webhook posting, switch to the webhook technique with a webhook URL secret.
- Confirm the secret has a value on this trigger.
.github/workflows/notify.yml
- uses: slackapi/slack-github-action@v2
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: C0123456789
text: "Build complete"How to prevent it
- Pick one technique and supply the matching credential.
- Verify the Slack token scopes cover the method you call.
Related guides
Adding Slack Notifications on Failure to GitHub ActionsPost a Slack message when a GitHub Actions workflow fails using the official slack-github-action and an incom…
GitHub Actions docker/login-action "Username and password required"Fix docker/login-action "Error: Username and password required" - the action got an empty username or passwor…
GitHub Actions codecov/codecov-action "token required" (rate limit)Fix codecov/codecov-action "Token required" / tokenless rate limit - tokenless uploads are rate-limited, so a…