slack
A comprehensive Go client for the Slack Web API, RTM, Events API, and Socket Mode.
Repository Health
Technical Analysis
slack-go/slack is a community-maintained Go library that wraps nearly all of Slack’s api.slack.com REST surface, plus the Real-Time Messaging (RTM) protocol over websocket and Socket Mode for fully managed, firewall-friendly event delivery. A single slack.Client, constructed with slack.New(token), exposes typed methods for messaging, channels, users, files, reactions, admin APIs, and more, each returning strongly typed response structs instead of raw JSON.
Beyond the core API client, the module ships companion packages for the pieces a real Slack app needs: slackevents for parsing and routing the Events API payload, socketmode for a managed Socket Mode connection with an optional handler-based event router, and slacktest for spinning up a fake Slack server in unit tests. An extensive Block Kit builder API (block_*.go files) covers sections, headers, images, rich text, tables, and interactive elements for building modern Slack UIs, and opt-in HTTP retry handlers add resilience against rate limits and transient network failures.
What You Get
- A typed
Clientcovering most of the Slack Web API — messaging, channels/conversations, users, files, reactions, pins, bookmarks, admin, and audit endpoints - Full Block Kit builders for sections, headers, images, rich text, tables, data visualization blocks, and interactive elements
- Managed Socket Mode client and an event-handler router (
socketmode.SocketmodeHandler) for routing incoming events without hand-rolled switch statements - RTM (
NewRTM+ManageConnection) and legacy websocket-based real-time messaging support slackeventssubpackage for parsing and validating Events API callbacksslacktestsubpackage providing an in-process fake Slack server for writing unit tests without hitting the real API- Opt-in HTTP retry handling (
OptionRetry,OptionRetryConfig) for 429 rate limits, connection errors, and optional 5xx retries - OAuth flow helpers, interactive message/dialog support, and manifest (app configuration) APIs
Common Use Cases
- Building a Slack bot that posts and updates messages, reacts to mentions, and responds to slash commands
- Implementing a Socket Mode app that receives events over a persistent websocket without exposing a public HTTP endpoint
- Building rich interactive Slack UIs with Block Kit — modals, home tabs, and message attachments with buttons and menus
- Writing an internal ops tool that manages channels, users, or workspace admin settings via the Slack Web API
- Building a webhook receiver that parses and verifies Slack Events API payloads with
slackevents - Unit testing Slack integrations against
slacktest’s fake server instead of live Slack workspaces
Under The Hood
Architecture
A single slack package at the repo root holds roughly 190 Go files organized by API domain — chat.go, users.go, channels.go, admin*.go, and dozens of block_*.go files for Block Kit. Every API call funnels through the central Client struct defined in slack.go, which centralizes cross-cutting concerns like the auth token, debug logging, warning callbacks, and retry configuration, so a change to the core request path affects every method uniformly. Real-time transports (rtm.go, websocket.go, websocket_managed_conn.go) build on that same Client but layer their own managed-connection and reconnect state. Companion capabilities live in separate Go packages under subdirectories — socketmode/, slackevents/, slacktest/, slackutilsx/, internal/ — rather than folders within the main package, letting consumers import just what they need (e.g. Events API parsing without pulling in the RTM/websocket dependency chain).
Tech Stack
A Go module targeting Go 1.26 with a deliberately minimal dependency footprint: gorilla/websocket for the RTM and legacy websocket transports, stretchr/testify for test assertions, and go-test/deep for structural diffing in tests. There is no web framework, ORM, or database — this is a pure API-client library built on net/http, wrapped by an internal retry.go/backoff module that implements configurable, pluggable retry policies for rate limits, connection errors, and optional 5xx responses.
Code Quality
Test coverage is extensive — roughly 84 top-level _test.go files closely mirroring the production files, plus further tests inside socketmode/ and slacktest/, all using testify for assertions. Errors are explicit sentinel values defined through an internal errorsx.String type in errors.go rather than being swallowed, and retry.go shows careful handling of transient failures with a pluggable handler chain. CONTRIBUTING.md documents a make pr-prep step that runs formatting, linting, and the full test suite before a PR is opened, and CI runs on every push via .github/workflows/test.yml.
API Design
The public API favors ergonomics: slack.New(token) returns a ready-to-use client, most calls are one-liners returning strongly typed response structs instead of raw JSON, and a consistent functional-options pattern (Option, ParamOption) configures both the client and individual calls. Block Kit builders mirror Slack’s nested block JSON with typed Go constructors, cutting the boilerplate of hand-writing block payloads, and socketmode.SocketmodeHandler offers a registerable event router in place of a manual type-switch. The design isn’t conceptually novel — it’s a conventional REST/websocket SDK wrapper — but its breadth of coverage and the Socket Mode handler router are genuine ergonomic wins over calling the Slack HTTP API directly.
Used by 11 apps in this directory
Convoy
Developer Tools · Devops
Convoy is an open-source, cloud-native webhooks gateway that ingests events over HTTP or straight from Kafka, SQS, Google Pub/Sub, and RabbitMQ, then reliably delivers them to subscriber endpoints with signed payloads, automatic retries, circuit breaking, and JavaScript-based transformations.
Coroot
Analytics · Monitoring
eBPF-powered observability with AI root cause analysis — zero code changes required, full-stack visibility out of the box.
Digger
Devops · Automation · Developer Tools
Run Terraform and OpenTofu natively inside your existing CI pipeline — no separate runners, no third-party secrets, no extra compute costs.
Hatchet
AI Development · Developer Tools · Automation
A Postgres-backed orchestration engine for background tasks, AI agents, and durable workflows that replaces Redis queues and multi-datastore durable execution platforms with a single self-hostable service.
highlight.io
Developer Tools · Analytics · Monitoring
Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.
hoop
Security · Monitoring
A wire-protocol gateway that enforces data masking, command blocking, approval workflows, and full session recording for engineers and AI agents accessing production infrastructure.
infracost
Devops · Developer Tools
Infracost shows cloud cost estimates for Terraform, CloudFormation, and AWS CDK before you deploy — in your terminal, editor, AI coding agent, and pull requests.
Multica
AI Assistants · AI Development
Turn coding agents into real teammates — assign issues, track progress, and compound reusable skills across a vendor-neutral, self-hosted platform.
Ory Kratos
Authentication
API-first identity and user management that handles login, registration, MFA, and recovery so your application never has to.