返回博客
Guide

Script to Keep Slack Active: Why Most Stopped Working, What Works

Most scripts that promise to keep Slack active no longer work. Slack's API cannot force a user to active, bot tokens have their own presence, and OS keypress scripts miss the Slack window. What still works is a session-based client. How to test any script with users.getPresence.

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

Most scripts that promise to keep Slack active do not work today, for three reasons from Slack's own docs. First, users.setPresence accepts only auto and away; there is no way to force a user to active. Second, a bot token has its own presence, so a bot script cannot keep your dot green. Third, scripts that press keys or move the mouse at the operating-system level only count if the Slack window receives the input, because Slack counts only input inside its own window. What still works is a script that acts as your own Slack client from a session, the way the web app does, and keeps producing activity.

That is what Slack Green does, on a schedule, from its servers; if you want to run it yourself, the self-hosted Slack Green CLI runs the same engine on your own machine with your tokens on your own disk.

Scripts that keep Slack active: setPresence auto or away, auto_away after 10 minutes, OS scripts miss Slack, session-based works

Why most keep-Slack-active scripts stopped working

Kinds of keep-Slack-active scripts and whether they work today
ApproachWorks today?Why
users.setPresence with activeNoOnly auto or away are accepted
Bot token tricksNoA bot has its own presence
OS keypress or mouse scriptOnly with Slack focusedSlack counts only input in its window
Userscript in the Slack tabFragileBreaks on updates, tab discarding, screen lock
Session client from a serverYesActs as your own client

Slack's developer docs define presence plainly: a user is active if they have at least one client connected and are not marked away, and after 10 minutes with no activity Slack marks them away automatically. Many old GitHub scripts set presence=auto and assumed that meant green. auto only removes a manual away; without activity you are still away 10 minutes later. Details and code are in our Slack presence API guide.

OS-level scripts: PowerShell, AutoHotkey, Python pyautogui

Scripts that press F15 or nudge the mouse keep Windows or macOS awake, and keep Microsoft Teams green, because those watch the whole computer. Slack does not. The input has to land in the Slack window, which means Slack in front, the screen unlocked and the lid open. The PowerShell versions, and what they do for Teams, are in keep a Windows PC awake with PowerShell; the same limits apply to mouse jigglers.

Userscripts in the Slack browser tab

再也不会在Slack上显示「离开」

云端运行。无需下载。即使笔记本关机也能24/7运行。

A Tampermonkey-style script can fire events inside app.slack.com so the tab sees activity. It works only while that tab stays loaded and the computer stays awake, and a Slack web update can break it overnight. Browser memory savers can unload the tab; see keep Slack active in the browser. Browser extensions built on this idea have also been removed from the Chrome Web Store; see Slack Chrome extensions.

Session-based scripts: what still works

A client that signs in as you, with the same session the web app uses (the xoxc token and d cookie), counts as a connected client and can keep producing activity from any machine, with your laptop closed. That is how the web app itself stays active. How those tokens work, and the security trade-off of storing them anywhere, is in Slack xoxc and xoxd tokens. Tokens end when you sign out or your workspace's session duration expires, so any script needs to notice authentication errors.

Building and maintaining this yourself means handling reconnects, token expiry, schedules and time zones. The Slack Green CLI is that engine packaged for your own Mac, Linux box or server; Slack Green runs it for you in the cloud.

How to test any keep-active script

How to check if a keep-Slack-active script works: run, wait 11 minutes, call users.getPresence, read auto_away

  • Start the script and leave the computer alone. Lock it too.
  • Wait 11 minutes, past Slack's 10-minute idle window.
  • Ask Slack about yourself with a user token:
  • curl -s -H "Authorization: Bearer $SLACK_USER_TOKEN" https://slack.com/api/users.getPresence

  • Read the answer. "presence": "active" with "auto_away": false means it works. "auto_away": true means Slack saw no activity.

Is a keep-active script allowed?

再也不会在Slack上显示「离开」

云端运行。无需下载。即使笔记本关机也能24/7运行。

Slack's terms and your employer's policy both apply, and a script that signs in as you appears in your access logs. What an employer can see is covered in will I get caught using Slack Green and can Slack be used to monitor employees.

FAQ

Is there a script to keep Slack always active?

Only session-based ones still work reliably. API calls cannot force active, and OS scripts only help with Slack in focus.

Why does my Slack keep-active GitHub script not work anymore?

It probably calls users.setPresence, which accepts only auto or away, or uses a bot token, which has its own presence.

Can a Python script keep Slack green?

A pyautogui script only works with the Slack window focused. A session-based client can, with the trade-offs above.

Does a PowerShell script keep Slack active?

No, unless Slack is the focused window. It does keep Windows and usually Teams active.

How do I check if I am active on Slack from a script?

Call users.getPresence without a user ID and read presence and auto_away.

Always Active

别再晃动鼠标了。

数百名远程工作者再也不用担心Slack状态。设置一次,永远保持绿色。

Related Articles

Guide

Slack Jira Integration: Setup, /jira Commands and Notifications

Install the Jira Cloud for Slack app, type /jira connect in a channel to send a Jira space's updates there, /jira notify for personal notifications as DMs, and create work items from any message with More actions. Every /jira command, Jira automation to Slack, and fixes when previews or notifications stop.

Slack Green Team5 min read
Guide

How to Create a Slack Workspace, on Desktop or Phone

Go to slack.com/get-started, enter your email, type the confirmation code, and click Create a Workspace. It is free to start, you become the Primary Owner, and it takes about five minutes. Steps for desktop, iPhone and Android, and what to set up next.

Slack Green Team5 min read
Guide

Slack Sidebar Sections: Create, Sort, Share and Fix Them

Slack sidebar sections are custom groups of channels, DMs and apps in your sidebar. Only you see them, and they need a paid plan. How to create one on desktop and mobile, move many channels at once, sort and filter each section, share a section with your team, and get disappeared sections back.

Slack Green Team5 min read
    Script to Keep Slack Active: What Still Works