Slack Events API Python Adapter

raw JSON →
3.0.3 verified Fri May 01 auth: no python

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
error ImportError: cannot import name 'SlackEventAdapter' from 'slackeventsapi'
cause 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__)
error TypeError: __init__() missing 1 required positional argument: 'signing_secret'
cause 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)
error slackeventsapi.exceptions.SlackRequestVerificationFailed: Invalid request signature
cause 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.
error Challenges are not matched and the URL verification fails
cause 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.
breaking In 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.
deprecated The 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
gotcha Event 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.
breaking In 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.

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)