Volver al 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

Nunca más aparezcas como "ausente" en Slack

Basado en la nube. Sin descargas. Funciona 24/7 incluso con tu laptop apagada.

  • 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?

    Nunca más aparezcas como "ausente" en Slack

    Basado en la nube. Sin descargas. Funciona 24/7 incluso con tu laptop apagada.

    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

    Deja de Mover el Ratón.

    Cientos de trabajadores remotos ya no se preocupan por su estado de Slack. Configúralo una vez, mantente verde para siempre.

    Related Articles

    Guide

    Slack User Groups: How to Create, Mention and Manage Them

    A Slack user group is a named list of people with one @handle, like @designers, that notifies all of them and can add them to up to 100 default channels. How to create one, who can, how to mention it, and how it differs from a channel.

    Slack Green Team5 min read
    Guide

    How to Contact Slack Support: Form, Chat, Email and /feedback

    To contact Slack support, open slack.com/help/requests/new and click Contact support, or use Help > Contact us inside Slack, or type /feedback in any message box. Email feedback@slack.com if you cannot sign in. Slack lists no support phone line. Response times by plan and what to include.

    Slack Green Team5 min read
    Guide

    How to Make a Private Slack Channel Public, and Who Can

    Open the channel, click its name, go to Settings, and choose Change to a public channel. By default only Workspace Owners, Org Owners and Org Admins can do it. The whole history and every file become visible to the workspace.

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