Skip to content

Connect Slack to a tool built with Claude or ChatGPT (2026)

Your tool built with Claude needs to alert the team in Slack: a signed quote, low stock, a request to approve. The reflex is to paste the Slack token into the code, where it ends up leaking. On while, it stays in while, and your AI never sees it. Here is how, in about ten minutes.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 18, 2026.

View as Markdown

Connect Slack to a tool built with Claude or ChatGPT: the Slack bot token kept in while, out of the code and out of the AI’s reach, and the tool posting team alerts to a Slack channel through the Slack API

A tool built with Claude or ChatGPT reaches another level when it alerts the team where it already is, in Slack. A signed quote, stock that drops below the threshold, an expense report waiting for approval: the team sees it right away. To post, the tool needs a Slack token. That is where things often go wrong: the token ends up pasted into the code, then pushed to GitHub. Slack revokes it when it finds it3, and the tool goes silent without telling anyone.

On while, the Slack token stays in while. The tool posts without ever holding it, and your AI never sees it.

The short version. Create an app at api.slack.com/apps, give it the chat:write scope, install it and copy its bot token, which starts with xoxb-. Ask your AI to connect Slack, then paste the token into while through the link it gives you. The tool posts in your channels, and every call is logged.

Webhook or bot token: which one to choose

Slack offers two ways to have a tool post, and they do not serve the same purpose.

Incoming webhookBot token
What it allowsPosting in a single channelPosting in chosen channels, reading depending on scopes
Where the secret livesIn the webhook URLIn the token, on its own
What it is tied toOne channel and the person who created itThe app, whoever the person is
Our advice on whileFor a quick testFor a team tool

The webhook is quick: one URL, one channel3. The bot token is more flexible, it does not depend on the person who installed it, and it stays valid when they leave the company2.

Connect Slack to your tool, in four steps

The whole thing takes about ten minutes, and you have no code to write.

  1. Create an app in Slack. At api.slack.com/apps, click Create New App, give it a name, the one that will sign the messages, and choose your workspace1.
  2. Give it the right to post. Under OAuth & Permissions, in Bot Token Scopes, add chat:write. Add chat:write.public if the bot should post in every public channel without being added to it1.
  3. Install it and copy the token. Click Install to Workspace, then go back to OAuth & Permissions. The bot token, which starts with xoxb-, shows there1,2.
  4. Paste the token into while. Ask your AI to connect Slack. It declares the connection and gives you a link, where you paste the token. Neither your AI nor the tool’s code sees it.

For a private channel, add the bot to the channel with the /invite @bot-name command1. If your Workspace Owners have turned on app approval, the installation in step 3 waits for their approval4.

You, to your AI: Connect Slack to this tool, and post in the #orders channel every time an order goes over $5,000.

A tool built with AI posts in Slack through while: the Slack bot token is added to each call inside while, out of the code, and every message sent to the team channel is logged in the history
The tool posts in Slack through while, which adds the token to each call.

What while does on each call

The tool calls Slack through while, without a token. while adds the bot token to each call, and logs it in the history. For the first seven days, reads go through and teach while what the tool calls. Posting a message is a write: it goes through once you approve its rule. After that, an unexpected call is refused, and your AI is told.

You can also ask for your approval before a sensitive call.

You, to your AI: Ask me before the tool posts in the #general channel.

The credentials of your software are detailed on our security page, and the same mechanism works for any API in connect an API with no credentials in the code.

Changing the token

If the token leaks or you recreate the app, Slack gives you a new one under OAuth & Permissions. Paste it into while: the tool uses it from the next call, without being put back in place, and your AI has nothing to redo.

What while adds around it

  • Your colleagues use the tool with a while account for up to 3 people, or, on the Pro plan, with their email account, Google or Microsoft. See keep a tool for your colleagues.
  • Connected software: one on the Libre plan, and 25 on the Pro plan, Slack included.
  • The tool’s data is backed up every day, and your tools are hosted in France by Nextmap.

For stock alerts ready to post, see the inventory tracker with alerts, and for related connections, connect HubSpot and connect Google Sheets.

Try it with your tool

Give this message to your AI, then ask it to connect Slack. The trial is free, with no sign-up, and your tool has its address in 3 minutes.

The message to give your AI
Read while.sh/agents and help me get started with while.

In the docs: Variables and secrets.

Sources

  1. Slack, Quickstart with app settings, accessed November 18, 2026
  2. Slack, Tokens, accessed November 18, 2026
  3. Slack, Sending messages using incoming webhooks, accessed November 18, 2026
  4. Slack, Manage app approval for your workspace, accessed November 18, 2026

Questions

How do you get a Slack API token?

Create an app at api.slack.com/apps, add the chat:write scope under OAuth & Permissions, then install it to your workspace. The bot token, which starts with xoxb-, then shows on the same page1.

Do you need a Slack admin to create the token?

Not by default. If the Workspace Owners have turned on app approval, the installation waits for their approval4.

Does my AI see the Slack token?

No. Your AI declares the connection to Slack and gives you a link. You paste the token into while there, and neither your AI nor the tool’s code sees it.

Why doesn’t the bot post in my channel?

It is not part of the channel yet. Add it with the /invite command followed by its name, or give it the chat:write.public scope for public channels1.

Isn’t an incoming webhook enough?

To post in a single channel, it is. But the webhook URL contains the secret itself, and Slack revokes it when it leaks3. The bot token works across channels, and while keeps it out of the code.

Give your AI the message, and it takes care of the rest

Give this to your AI

Read while.sh/agents and help me get started with while.

Copy the message

In 3 minutes, with no sign-up, the tool has its own address. To keep it, create your account.

For a company project, write to the while team: hello@while.sh