Skip to main content

slack api decorator

Project description

slack-api-decorator

github-pytest codecov PythonVersion PiPY

Slack-API-decorator provides simple decorator to receive slack-payload: Slash Command and Event Subscription.

install

$ pip install slackapidecorator

usage

Slash Command

from slack_api_decorator import SlashCommand 
sc = SlashCommand(app_name="sample")

@sc.add(command="/example")
def accept_example(params):
    return params


sc.execute(params={"payload from": "slack"})

Event Subscription

The events below are supported:

  • file_upload
  • message
  • reaction_added
from slack_api_decorator import EventSubscription

event_subscription = EventSubscription(app_name="sample")

@event_subscription.add(event_type="file_upload")
def file_upload_example(params):
    return params

@event_subscription.add("reaction_added", channel_id="Uxxxxxxxx")
def reaction_added_in_channel(params):
    return params

event_subscription.execute(params={"payload from": "slack"})

Project details


Download files

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

Source Distribution

slackapidecorator-0.2.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

slackapidecorator-0.2.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file slackapidecorator-0.2.0.tar.gz.

File metadata

  • Download URL: slackapidecorator-0.2.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for slackapidecorator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 25d1c4113bebc2729d10452e50f73ec19f25e822b2779d39b135c2ccbba9ae67
MD5 4205122545d8165efa81608bbd73b631
BLAKE2b-256 5d8a0fba49719e1c66ab808fcf2a79dc18a934075f82630cef563ad888dc7f89

See more details on using hashes here.

File details

Details for the file slackapidecorator-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: slackapidecorator-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for slackapidecorator-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b7331de98cb8c056e182e0d53da3d10bd8c02f3ccff958760128122088f94c6
MD5 cd836d21071028a3e20a17581faa08d7
BLAKE2b-256 ed421b5d8e2ca1cd8ec3d842edaf970aaa0d7462c77a5b60dbbc4325f5ce930d

See more details on using hashes here.

Supported by

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