Skip to main content

imbi-slackbot

A Slack bot for the Imbi DevOps service management platform. It behaves like the Imbi assistant — giving Claude live access to Imbi data and actions through tools — but speaks Slack and acts as the Slack user who asked, so every answer and action respects that user's Imbi permissions.

How It Works

The bot connects to Slack over Socket Mode (an outbound websocket, so no public ingress is required). When a user mentions the bot or DMs it, the bot:

  1. Resolves the Slack user to an Imbi user. It looks up the Slack user's email (users.info), finds the matching active Imbi User in the graph, and mints a short-lived per-user JWT access token signed with the shared IMBI_AUTH_JWT_SECRET — exactly the token the Imbi API issues at login. The resolution is cached with a TTL. Users with no matching Imbi account get a friendly explanation instead.
  2. Reconstructs the thread context from Slack (conversations.replies) so follow-up questions in a thread keep their history. Nothing is persisted server-side; the Slack thread is the conversation.
  3. Runs Claude with the Imbi toolset. Tools are built at startup from the Imbi API's openapi.json via an in-process FastMCP server, using the shared imbi_common.mcp exclusion policy (auth/MFA/status/thumbnail and any x-imbi-ai-tool: false operations are filtered out). The user's minted token is forwarded on every tool call, so the API enforces their permissions.
  4. Replies in-thread with Claude's answer.

A tiny FastAPI app exposes /status (port 8004) for health checks; the Socket Mode connection runs as a background task alongside it.

Configuration

Environment variable Purpose
SLACK_BOT_TOKEN Slack bot token (xoxb-…)
SLACK_APP_TOKEN Slack app-level token for Socket Mode (xapp-…)
ANTHROPIC_API_KEY Anthropic API key (enables the bot when set)
IMBI_AUTH_JWT_SECRET Shared HS256 secret used to mint per-user tokens
IMBI_INTERNAL_API_URL In-cluster base URL of the Imbi API
IMBI_UI_URL Public base URL of the Imbi UI, used to build deep links
IMBI_INTERNAL_UI_URL In-cluster UI address for fetching llms.txt (e.g. the Caddy frontend); falls back to IMBI_UI_URL
POSTGRES_URL Imbi graph (Apache AGE) connection URL
IMBI_SLACKBOT_MODEL Claude model (default claude-sonnet-4-6)

See src/imbi_slackbot/settings.py for the full set.

Development

moon run root:setup      # install deps + pre-commit hooks
moon run slackbot:test   # run the test suite with coverage
moon run slackbot:lint slackbot:typecheck slackbot:format   # ruff + basedpyright + format check
uv run --env-file .env.test imbi-slackbot serve   # run the bot

Releasing

[project].version in pyproject.toml is the single source of truth (the git tag does not set it). To cut a release:

  1. Bump the version and re-lock in one step: uv version <new-version> (updates pyproject.toml and uv.lock). If a shared-library pin changed (e.g. imbi-common==<version>), update it first so the re-lock picks it up.
  2. Commit, open a PR, and merge to main once CI is green.
  3. Create a GitHub release whose tag is v<version> matching the bumped version. Publishing the release runs .github/workflows/publish.yml, which verifies the tag matches the package version before building and uploading to PyPI — so an un-bumped release fails fast instead of trying to re-publish an existing filename (which PyPI rejects with a 400).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imbi_slackbot-2.21.0.tar.gz (41.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imbi_slackbot-2.21.0-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file imbi_slackbot-2.21.0.tar.gz.

File metadata

  • Download URL: imbi_slackbot-2.21.0.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for imbi_slackbot-2.21.0.tar.gz
Algorithm Hash digest
SHA256 db82588ee3c4bc51f1e18bced3269b58a4c6d95dccd7bcc8fbd10efbf941f944
MD5 0ba9e755aa8a42de3d698f8de1720248
BLAKE2b-256 ec10ddc322534ccaab36f966c778cae4ad4113bbb3624a8c5a6371cfc599f8b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbi_slackbot-2.21.0.tar.gz:

Publisher: release.yml on AWeber-Imbi/imbi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imbi_slackbot-2.21.0-py3-none-any.whl.

File metadata

  • Download URL: imbi_slackbot-2.21.0-py3-none-any.whl
  • Upload date:
  • Size: 36.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for imbi_slackbot-2.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03005ab92bf713106f1f72e128fa7c6865b1a88430c326ea485b197c00edb4f5
MD5 77afa4e41a2152c7a598fc1e774273c4
BLAKE2b-256 b475d80a2794f15e76fd6705b85bec33b9678df82dbbb74b332f1e433fa2d50d

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbi_slackbot-2.21.0-py3-none-any.whl:

Publisher: release.yml on AWeber-Imbi/imbi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page