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.
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.
- 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.