Registry / communication / slackeventsapi

slackeventsapi

JSON →
library3.0.3pypypi✓ verified 84d ago

A Python adapter for the Slack Events API, built on Flask. It handles event verification, parsing, and dispatching for incoming Slack events. The current version is 3.0.3, requiring Python >=3.6 and Flask 2.x. Releases are irregular as the library is in maintenance mode.

pip install slackeventsapi
INSTALL
IMPORT
SIG · SLACKEVENTSAPI
S
slackeventsapi
communicationpythonv3.0.3
Install
2.4s avg
Import
605ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.622s · 22.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.588s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SlackEventAdapter
from slackeventsapi import SlackEventAdapter
verify_signature
from slackeventsapi import verify_signature

Minimal Flask app using SlackEventAdapter to respond to app_mention events.

import os from flask import Flask from slackeventsapi import SlackEventAdapter app = Flask(__name__) slack_signing_secret = os.environ.get('SLACK_SIGNING_SECRET', '') slack_events_adapter = SlackEventAdapter(slack_signing_secret, "/slack/events", app) @slack_events_adapter.on("app_mention") def handle_app_mention(event_data): print("App mentioned:", event_data) return "OK" if __name__ == "__main__": app.run(port=3000)
Debug
Known issues
breakingIn v3.0.0, dropped support for Python 2.7 and Flask 1.x. Ensure your environment uses Python >=3.6 and Flask >=2.0.
fix
Upgrade Python to 3.6+ and Flask to 2.x.
affects: >=3.0.0
deprecatedThe library is in maintenance mode; no new features are planned. Slack recommends using Bolt for Python (slack_bolt) for new projects.
fix
Migrate to slack_bolt: https://github.com/slackapi/bolt-python
affects: all
gotchaEvent acknowledgements must be sent within 3 seconds. Long-running handler blocks the response; use threads or async to avoid timeout.
fix
Offload processing to a background thread or queue. See GitHub issue #84.
affects: all
breakingIn v2.0.0, switched from Verification Token to Signing Secret. Old code using Verification Token will fail.
fix
Update your app to use Signing Secret from Slack app settings. Pass signing_secret instead of verification_token.
affects: <2.0.0
Errors
Common errors & fixes
ImportError: cannot import name 'SlackEventAdapter' from 'slackeventsapi'
The package is installed but not correctly imported; or version does not export that name.
fix
Run: pip uninstall slackeventsapi && pip install slackeventsapi. If still fails, check the package version: import slackeventsapi; print(slackeventsapi.__version__)
TypeError: __init__() missing 1 required positional argument: 'signing_secret'
The first argument to SlackEventAdapter is now signing_secret (required in v2.0+).
fix
Pass your Slack app's signing secret: SlackEventAdapter('your_signing_secret', '/events', app)
slackeventsapi.exceptions.SlackRequestVerificationFailed: Invalid request signature
Request signature verification failed. Usually due to misconfigured signing_secret or clock drift.
fix
Double-check SLACK_SIGNING_SECRET environment variable. Ensure server time is accurate (NTP). If behind a proxy, forward original headers.
Challenges are not matched and the URL verification fails
The event URL verification endpoint returns unexpected body or status code.
fix
Ensure your route returns a plain text response with the challenge value. Using SlackEventAdapter automatically handles it.
Upgrade
Version history
3.0.3latest on PyPI · released Sep 5, 2024
Audit
Dependencies
flaskrequiredRequired for handling HTTP requests and event routing.
pyeerequiredUsed for event emitter pattern; v3.0.3 pins max version due to breaking changes.
requestsrequiredUsed for verifying signing secrets and outgoing requests.
Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
1
Resources
slackeventsapi — pip install slackeventsapi · libregistry