slackapidecorator

slack api decorator


Keywords
slack, slack-api, slash-command, event-subscription
License
MIT
Install
pip install slackapidecorator==0.2.0

Documentation

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"})