Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gsy0911/slack-api-decorator
Slack-API-decorator provides simple decorator to receive slack-payload: Slash Command and Event Subscription.
https://github.com/gsy0911/slack-api-decorator
Last synced: 24 days ago
JSON representation
Slack-API-decorator provides simple decorator to receive slack-payload: Slash Command and Event Subscription.
- Host: GitHub
- URL: https://github.com/gsy0911/slack-api-decorator
- Owner: gsy0911
- Created: 2020-08-08T00:04:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-17T01:11:35.000Z (almost 2 years ago)
- Last Synced: 2025-01-15T14:15:09.921Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 368 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# slack-api-decorator
[![github-pytest](https://github.com/gsy0911/slack-api-decorator/workflows/pytest/badge.svg)](https://github.com/gsy0911/slack-api-decorator/actions?query=workflow%3Apytest)
[![codecov](https://codecov.io/gh/gsy0911/slack-api-decorator/branch/master/graph/badge.svg)](https://codecov.io/gh/gsy0911/slack-api-decorator)
[![PythonVersion](https://img.shields.io/badge/python-3.8|3.9-blue.svg)](https://www.python.org/downloads/release/python-3812/)
[![PiPY](https://img.shields.io/pypi/v/slackapidecorator.svg)](https://pypi.org/project/slackapidecorator/)Slack-API-decorator provides simple decorator to receive slack-payload: `Slash Command` and `Event Subscription`.
## install
```bash
$ pip install slackapidecorator
```## usage
### Slash Command
```python
from slack_api_decorator import SlashCommand
sc = SlashCommand(app_name="sample")@sc.add(command="/example")
def accept_example(params):
return paramssc.execute(params={"payload from": "slack"})
```### Event Subscription
The events below are supported:
* `file_upload`
* `message`
* `reaction_added````python
from slack_api_decorator import EventSubscriptionevent_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 paramsevent_subscription.execute(params={"payload from": "slack"})
```