Slack Error: 'as_user_not_supported' — Cause, Fix, and Troubleshooting Guide
Fix the Slack as_user_not_supported error: bot tokens can no longer post as a user. Drop as_user and set username/icon via chat:write.customize.
- #slack
- #api
- #troubleshooting
- #errors
Stuck on this Slack error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Overview
as_user_not_supported means you passed as_user=true on a call like chat.postMessage with a bot token. Slack retired the ability for bot tokens to post “as the authorising user”; a bot always posts as itself.
{
"ok": false,
"error": "as_user_not_supported"
}
It surfaces on chat.postMessage, chat.update, and chat.meMessage whenever the as_user argument is present with a xoxb- token.
Symptoms
- A call that worked on a legacy token now fails the moment you send
as_user=true. - Removing
as_usermakes the identical payload succeed. - Only affects bot (
xoxb-) tokens; nothing to do with scopes or channel membership.
Common Root Causes
1. Legacy code still sends as_user
Older SDK samples and copy-pasted snippets set as_user: true to impersonate the installing user. Bot tokens no longer honour it.
2. Migrated from a legacy custom-integration token
Legacy tokens allowed impersonation. After moving to a real Slack app with a bot token, the same argument is now rejected.
3. Trying to override display name/icon the old way
Teams used as_user together with username/icon_url to control appearance. That override now requires an explicit scope instead.
How to diagnose
Reproduce with and without the argument:
# Fails
curl -s -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"channel":"C0123456789","text":"deploy done","as_user":true}'
{"ok": false, "error": "as_user_not_supported"}
# Succeeds
curl -s -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"channel":"C0123456789","text":"deploy done"}'
Fixes
- Delete the
as_userargument. A bot token always posts as the app’s bot user; nothing else is needed for a normal message. - To customise name/icon per message, request the
chat:write.customizescope and passusernameandicon_url(oricon_emoji) instead ofas_user. - To genuinely post as a human, use a user token (
xoxp-) withchat:write— but prefer the bot identity for ops automation so messages are clearly machine-generated.
What to watch out for
chat:write.customizeonly changes the visible name/avatar; the author is still the app. Do not use it to fake a specific human.- Grep your codebase for
as_userbefore shipping a token migration — it is the single most common breakage when moving off legacy integrations. - The bot’s default name/icon come from the app’s configuration; set them there so most messages need no per-call override.
Related
Fixed it? Get 500 Slack & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.