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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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