{"id":13994114,"url":"https://github.com/slackapi/python-slack-events-api","last_synced_at":"2025-05-15T20:06:11.594Z","repository":{"id":17791066,"uuid":"82717869","full_name":"slackapi/python-slack-events-api","owner":"slackapi","description":"Slack Events API adapter for Python (Flask required)","archived":false,"fork":false,"pushed_at":"2024-09-05T01:21:18.000Z","size":148,"stargazers_count":345,"open_issues_count":2,"forks_count":116,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-04-08T01:38:18.379Z","etag":null,"topics":["python","slack","slackapi"],"latest_commit_sha":null,"homepage":"https://api.slack.com/events","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slackapi.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-21T19:21:16.000Z","updated_at":"2025-04-04T02:19:05.000Z","dependencies_parsed_at":"2024-09-06T05:23:43.381Z","dependency_job_id":null,"html_url":"https://github.com/slackapi/python-slack-events-api","commit_stats":{"total_commits":81,"total_committers":22,"mean_commits":"3.6818181818181817","dds":0.691358024691358,"last_synced_commit":"2884d7d21fea634d1e5e7926409ed87f6fcc14cf"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fpython-slack-events-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fpython-slack-events-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fpython-slack-events-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slackapi%2Fpython-slack-events-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slackapi","download_url":"https://codeload.github.com/slackapi/python-slack-events-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253029773,"owners_count":21843157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","slack","slackapi"],"created_at":"2024-08-09T14:02:42.771Z","updated_at":"2025-05-15T20:06:06.558Z","avatar_url":"https://github.com/slackapi.png","language":"Python","readme":"Slack Events API adapter for Python\n===================================\n\n.. image:: https://badge.fury.io/py/slackeventsapi.svg\n  :target: https://pypi.org/project/slackeventsapi/\n.. image:: https://github.com/slackapi/python-slack-events-api/actions/workflows/ci-build.yml/badge.svg\n  :target: https://github.com/slackapi/python-slack-events-api/actions/workflows/ci-build.yml\n.. image:: https://codecov.io/gh/slackapi/python-slack-events-api/branch/main/graph/badge.svg\n  :target: https://codecov.io/gh/slackapi/python-slack-events-api\n\n\nThe Slack Events Adapter is a Python-based solution to receive and parse events\nfrom Slack’s Events API. This library uses an event emitter framework to allow\nyou to easily process Slack events by simply attaching functions\nto event listeners.\n\nThis adapter enhances and simplifies Slack's Events API by incorporating useful best practices, patterns, and opportunities to abstract out common tasks.\n\n💡  We wrote a `blog post which explains how`_ the Events API can help you, why we built these tools, and how you can use them to build production-ready Slack apps.\n\n.. _blog post which explains how: https://medium.com/@SlackAPI/enhancing-slacks-events-api-7535827829ab\n\n⚠️  Important Notice\n---------------------\n\nIf you use this library for Events API handling, you may need to use threads for stable event acknowledgement. See https://github.com/slackapi/python-slack-events-api/issues/84 for details.\n\nIf you're looking for the best recommended library at this point, check Bolt for Python: https://github.com/slackapi/bolt-python\n\nThe framework covers not only Events API but also all the latest Slack Platform features.\n\n🤖  Installation\n----------------\n\n.. code:: shell\n\n  pip install slackeventsapi\n\n🤖  App Setup\n--------------------\n\nBefore you can use the `Events API`_ you must\n`create a Slack App`_, and turn on\n`Event Subscriptions`_.\n\n💡  When you add the Request URL to your app's Event Subscription settings,\nSlack will send a request containing a `challenge` code to verify that your\nserver is alive. This package handles that URL Verification event for you, so\nall you need to do is start the example app, start ngrok and configure your\nURL accordingly.\n\n✅  Once you have your `Request URL` verified, your app is ready to start\nreceiving Team Events.\n\n🔑  Your server will begin receiving Events from Slack's Events API as soon as a\nuser has authorized your app.\n\n🤖  Development workflow:\n===========================\n\n(1) Create a Slack app on https://api.slack.com/apps\n(2) Add a `bot user` for your app\n(3) Start the example app on your **Request URL** endpoint\n(4) Start ngrok and copy the **HTTPS** URL\n(5) Add your **Request URL** and subscribe your app to events\n(6) Go to your ngrok URL (e.g. https://myapp12.ngrok.com/) and auth your app\n\n**🎉 Once your app has been authorized, you will begin receiving Slack Events**\n\n    ⚠️  Ngrok is a great tool for developing Slack apps, but we don't recommend using ngrok\n    for production apps.\n\n🤖  Usage\n----------\n  **⚠️  Keep your app's credentials safe!**\n\n  - For development, keep them in virtualenv variables.\n\n  - For production, use a secure data store.\n\n  - Never post your app's credentials to github.\n\n.. code:: python\n\n  SLACK_SIGNING_SECRET = os.environ[\"SLACK_SIGNING_SECRET\"]\n\nCreate a Slack Event Adapter for receiving actions via the Events API\n-----------------------------------------------------------------------\n**Using the built-in Flask server:**\n\n.. code:: python\n\n  from slackeventsapi import SlackEventAdapter\n\n\n  slack_events_adapter = SlackEventAdapter(SLACK_SIGNING_SECRET, endpoint=\"/slack/events\")\n\n\n  # Create an event listener for \"reaction_added\" events and print the emoji name\n  @slack_events_adapter.on(\"reaction_added\")\n  def reaction_added(event_data):\n    emoji = event_data[\"event\"][\"reaction\"]\n    print(emoji)\n\n\n  # Start the server on port 3000\n  slack_events_adapter.start(port=3000)\n\n\n**Using your existing Flask instance:**\n\n\n.. code:: python\n\n  from flask import Flask\n  from slackeventsapi import SlackEventAdapter\n\n\n  # This `app` represents your existing Flask app\n  app = Flask(__name__)\n\n\n  # An example of one of your Flask app's routes\n  @app.route(\"/\")\n  def hello():\n    return \"Hello there!\"\n\n\n  # Bind the Events API route to your existing Flask app by passing the server\n  # instance as the last param, or with `server=app`.\n  slack_events_adapter = SlackEventAdapter(SLACK_SIGNING_SECRET, \"/slack/events\", app)\n\n\n  # Create an event listener for \"reaction_added\" events and print the emoji name\n  @slack_events_adapter.on(\"reaction_added\")\n  def reaction_added(event_data):\n    emoji = event_data[\"event\"][\"reaction\"]\n    print(emoji)\n\n\n  # Start the server on port 3000\n  if __name__ == \"__main__\":\n    app.run(port=3000)\n\nFor a comprehensive list of available Slack `Events` and more information on\n`Scopes`, see https://api.slack.com/events-api\n\n🤖  Example event listeners\n-----------------------------\n\nSee `example.py`_ for usage examples. This example also utilizes the\nSlackClient Web API client.\n\n.. _example.py: /example/\n\n🤔  Support\n-----------\n\nNeed help? Join `Slack Community`_ and talk to us in `#slack-api`_.\n\nYou can also `create an Issue`_ right here on GitHub.\n\n.. _Events API: https://api.slack.com/events-api\n.. _create a Slack App: https://api.slack.com/apps/new\n.. _Event Subscriptions: https://api.slack.com/events-api#subscriptions\n.. _Slack Community: http://slackcommunity.com/\n.. _#slack-api: https://dev4slack.slack.com/messages/slack-api/\n.. _create an Issue: https://github.com/slackapi/python-slack-events-api/issues/new\n","funding_links":[],"categories":["Python",":hammer_and_wrench: \u0026nbsp; Libraries and SDKs"],"sub_categories":["Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslackapi%2Fpython-slack-events-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslackapi%2Fpython-slack-events-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslackapi%2Fpython-slack-events-api/lists"}