8000 feat(slack): built-in Slack app over Socket Mode by adeelahmad · Pull Request #287 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(slack): built-in Slack app over Socket Mode - #287

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-js668b
Oct 11, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-js668b

Conversation

@adeelahmad
@adeelahmad adeelahmad commented Oct 10, 2026 •
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Builds on the chat-channel layer from #293, which is now merged.

Description

Before: the assistant reached Slack only through Matterbridge.

After: Settings › Slack has a link that creates a Slack app from Lens's manifest in one click. Install it, paste its two tokens (bot xoxb-… and app-level xapp-…) and turn it on. The assistant then answers:

  • direct messages, which are always for it;
  • channel messages that name it or @mention it (or every message with answer "all"), in the thread they were in;
  • /lens <question> anywhere, answered in that channel. /lens clear and /lens compact are the chat commands.

It does this over Socket Mode, with no Matterbridge and no public address. Voice clips are transcribed, and files are held for the assistant to import. Namespace routing, "yes" approvals in the room, the allowed-people list and channels given to a namespace's assistant (slack/general = pods) work as in Matterbridge and Telegram rooms.

How: app/domain/slack.py adds a Slack(channels.Channel). The process that holds the channel's lease keeps a Socket Mode connection open. That connection acknowledges every envelope straight away (Slack wants an acknowledgement within 3 s) and queues the message. fetch() hands the queue to the channel thread, which answers in order through bridge.handle. The connection closes when the tokens change or the lease moves. The bot token is sent only to files.slack.com, and redirects elsewhere are refused. websockets was already a dependency (BSD-3).

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (ruff, mypy, eslint, tsc clean).
  • I added or updated tests (tests/api/test_slack.py, tests/fake_slack.py).
  • I updated docs/chat-rooms.md ("Slack, built in").
  • CHANGELOG ## Unreleased entry.

Done questions

  1. Goal: built-in Slack with the same room features as Matterbridge. It merges on green.
  2. Agents: yes. Slack is a channel to the agent, and its settings and checks are in the API (/settings/slack, /settings/slack/test).
  3. Zero setup: yes. Nothing new to install, and Socket Mode needs no public URL.
  4. Fewest clicks: one link creates the app from the manifest, then you paste two tokens.
  5. Settings in the web app: yes, Settings › Slack with defaults. It is off by default and not in the wizard.
  6. Light on a Pi: yes, one websocket in one process and no new dependency.
  7. Private: tokens are sealed secrets. The threat model is updated (Outbound component, admin-settings entry point, N-BRIDGE), and the validator passes.
  8. Cost: no new model calls beyond answering, which goes through the same path and ledger as other rooms.
  9. Defaults unchanged: yes, it is off.
  10. Safe upgrades: yes, a new settings section with defaults and no stored-data change.
  11. Honest: the docs describe only what is built.
  12. Tested and generated: the full backend suite passes locally (975), and so do frontend jest (759), tsc, eslint and mkdocs build --strict. make openapi was run.
  13. Open standards and licences: yes, nothing new.
  14. Refine later: Block Kit buttons for approvals, the Home tab, and streaming answers by editing the message.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FKrujJ1UrhR3AD5aSGcgN1

@adeelahmad adeelahmad self-assigned this Oct 10, 2026
@adeelahmad
adeelahmad force-pushed the claude/project-thread-js668b branch from 660e643 to 8963caa Compare October 10, 2026 20:34
@adeelahmad adeelahmad changed the title feat(slack): Slack Socket Mode client, app manifest and settings feat(slack): built-in Slack app over Socket Mode Oct 10, 2026
@adeelahmad
adeelahmad changed the base branch from main to claude/project-thread-cnpj08 October 10, 2026 20:34
Base automatically changed from claude/project-thread-cnpj08 to main October 11, 2026 02:22
Slack as an adapter of the chat-channel layer (channels.py): a Socket Mode
listener in the process holding the lease acknowledges every envelope and
queues messages for the channel thread, which answers through bridge.py
like Matterbridge and Telegram rooms. A manifest link creates the Slack
app in one click; the bot and app-level tokens are sealed settings.
Direct messages, mentions, threads, /lens (with clear and compact), voice
clips and files are handled. Settings page, docs, changelog and threat
model included.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKrujJ1UrhR3AD5aSGcgN1
@adeelahmad
adeelahmad force-pushed the claude/project-thread-js668b branch from 0790c19 to 3f9dd32 Compare October 11, 2026 02:28
@adeelahmad
adeelahmad merged commit 6cd8964 into main Oct 11, 2026
13 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-js668b branch October 11, 2026 02:40
adeelahmad pushed a commit that referenced this pull request Oct 11, 2026
The open-room check moves from Matterbridge to Channel.outside, so Slack
without a user list still makes changes ask first, as on main.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdrxhwvmLjFsfzQZ5pRJGC
adeelahmad added a commit that referenced this pull request Oct 11, 2026
…monitoring switch as built (#351)

"Ask" names the built-in Telegram bot (#293) and Slack app (#287); "Connect your agents" adds mounting the graph's
files read-only over S3, WebDAV, NFS or SMB (#324, #295, #305) and copying the MCP address from the account menu
(#340); "Watch it run" says one switch in the web app starts Prometheus and Grafana (#337); "Light by default" adds
the cloud model presets (#334). The docs index gains the NFS and SMB pages, and "In progress" keeps only open PRs.


Claude-Session: https://claude.ai/code/session_01HDx7PPUauyjMn1LZs8JAsS

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0