How to add a New EventΒΆ
Add a new module in the src/slackly/events/ directory. Follow the below template:
@register_event('accounts_changed') class AccountsChanged(BaseEvent): """ .. code-block:: json :caption: Example json response { "type": "accounts_changed" } For more information see https://api.slack.com/events/accounts_changed """ @property def schema(self): return { 'type': types.String, }
Be sure of the following details:
- The event should be “registered” under the string found in event[‘type’] key
- The class subclasses from
slackly.events.BaseEvent
- The class includes a rst json code-block with an example event json blob
- Although it is not 100% necessary, please include a schema property as shown
Add an import in src/slackly/events/__init__.py
from .accounts_changed import AccountsChanged
Add an example json file in tests/data/events/[YOUR EVENT]/example.json, where [YOUR EVENT] is the string you registered
Run the test suite