Back to Blog
Guide

Slack Bot Token: How to Get One, and xoxb vs xoxp Explained

A Slack bot token starts with xoxb- and acts as your app's bot user. Get one by creating an app at api.slack.com/apps, adding bot scopes under OAuth & Permissions, installing the app, and copying the Bot User OAuth Token. How it differs from xoxp user tokens, xapp app-level tokens, xoxe rotation and xoxc session tokens.

Slack Green Team
September 23, 2026
September 23, 2026
5 min read
Share:
slack api
developers
slack tokens

A Slack bot token starts with xoxb- and lets your app act as its own bot user. To get one, create an app at api.slack.com/apps, open OAuth & Permissions, add Bot Token Scopes such as chat:write, click Install to Workspace, approve it, and copy the Bot User OAuth Token. A user token starts with xoxp- and acts as the person who approved it. Slack's docs recommend bot tokens for most apps, because they stay working even if the installing user is deactivated.

Some things only a user can do: a bot has its own presence and cannot set yours, for example. That is why tools that keep your own Slack dot green, like Slack Green, use your signed-in session rather than a bot token; the difference is covered in Slack xoxc and xoxd tokens.

Slack bot token: how to get one, xoxb, xoxp, xapp, xoxe, xwfp prefixes

How to get a Slack bot token

Get a Slack bot token: create an app, add bot scopes, install, copy the token

  • Go to api.slack.com/apps, click Create New App, choose From scratch, name it and pick the workspace.
  • Open OAuth & Permissions and add Bot Token Scopes, for example chat:write to post and users:read to read people and presence.
  • Click Install to Workspace and Allow. Some workspaces require an admin to approve new apps.
  • Copy the Bot User OAuth Token (xoxb-...) and store it as a secret, never in code or a public repository.
  • Invite the bot to any channel it needs to post in: /invite @your-bot.
  • When you add scopes later, reinstall the app so the token gets them.

    Test it:

    curl -s -H "Authorization: Bearer $SLACK_BOT_TOKEN" https://slack.com/api/auth.test

    Slack token types and prefixes

    Slack token prefixes: xoxb, xoxp, xapp, xoxe, xwfp, xoxc and xoxd
    PrefixTokenActs as
    xoxb-Bot tokenYour app's bot user
    xoxp-User tokenThe user who approved the app
    xapp-App-level tokenThe app across all its installs
    xoxe.xoxb-, xoxe.xoxp-Rotating access tokenBot or user, expires after 12 hours
    xoxe-Refresh tokenUsed to get a new access token
    xwfp-Workflow tokenA workflow step, for at most 15 minutes
    xoxc-, xoxd-Web client sessionYou, as the Slack web app

    Slack's docs also describe configuration tokens for the App Manifest APIs and service tokens for apps built with the Deno Slack SDK.

    xoxb vs xoxp

Never appear "away" on Slack again

Cloud-based. No downloads. Works 24/7 even when your laptop is off.

  • xoxb (bot) acts as the app. Messages come from the bot. It keeps working if the installing person leaves. Use it for almost everything.
  • xoxp (user) acts as a person, with that person's access. Writes look like they came from them. Use it only when an action must be done as the user, such as users.profile.set for their own status.
  • A user token also carries user scopes that the user approved. Slack's docs note that user token actions are performed as if by the user themselves.

    xoxe tokens and token rotation

    If you turn on token rotation in your app settings, oauth.v2.access returns an access token with an xoxe. prefix that expires after 43,200 seconds (12 hours), plus a refresh token starting with xoxe-. Call oauth.v2.access with grant_type=refresh_token before it expires to get a new pair.

    xapp app-level tokens

    App-level tokens start with xapp- and come from Basic Information in your app settings. They are for app-wide APIs, most often Socket Mode connections, not for posting messages.

    Which token can set presence?

    Never appear "away" on Slack again

    Cloud-based. No downloads. Works 24/7 even when your laptop is off.

    users.setPresence sets the calling user's presence to away or auto, so with a user token it changes the user's own dot; a bot token changes the bot's. No token can force a user to active. Code and fields are in our Slack presence API guide.

    FAQ

    How do I get a Slack bot token?

    Create an app at api.slack.com/apps, add bot scopes, install it to your workspace, and copy the Bot User OAuth Token from OAuth & Permissions.

    What is the difference between xoxb and xoxp?

    xoxb acts as your app's bot. xoxp acts as the user who approved the app.

    Do Slack bot tokens expire?

    Not unless you turn on token rotation; then access tokens expire after 12 hours and you refresh them.

    What is an xoxe token?

    With rotation on, xoxe. prefixes a short-lived access token and xoxe- starts the refresh token.

    What are xoxc and xoxd tokens?

    The web client's session token and cookie; see Slack xoxc and xoxd tokens.

    Always Active

    Stop Jiggling Your Mouse.

    Join hundreds of remote workers who never worry about their Slack status. Set it up once, stay green forever.

    Related Articles

    Guide

    Slack Workflow Builder Examples: 12 Workflows to Copy, With Triggers and Steps

    Twelve Slack Workflow Builder examples with the exact trigger and steps for each: daily standups, channel welcomes, time-off approvals, help desk requests, emoji escalations, keyword routing, incidents, list updates and webhooks from other tools. Plus where Workflow Builder lives, what it costs and how branches work.

    Slack Green Team5 min read
    Guide

    Slack Timer: How to Set a Countdown, Pomodoro or Focus Timer in Slack

    Slack has no built-in timer, but four built-in tools act like one: /remind me to ... in 25 minutes, a status that clears itself, /dnd for a focus block, and Workflow Builder for dated countdowns. For a live countdown in a channel, use a Marketplace app or a 15-line bot script.

    Slack Green Team5 min read
    Guide

    Slack Saved for Later: Where the Later Tab Is and How It Works

    Saved messages in Slack live in the Later tab, which replaced stars and Saved items in 2023. Hover a message and click Save for later, or press A. Add a reminder, mark items complete, and find them with is:saved. Where Later is on desktop and mobile, and what changed.

    Slack Green Team5 min read
      Slack Bot Token: How to Get One, xoxb vs xoxp