Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lightning-universe/slack-command-bot-component
With this component you can create a Slack bot and enable interactivity with the Slash Commands.
https://github.com/lightning-universe/slack-command-bot-component
Last synced: 7 days ago
JSON representation
With this component you can create a Slack bot and enable interactivity with the Slash Commands.
- Host: GitHub
- URL: https://github.com/lightning-universe/slack-command-bot-component
- Owner: Lightning-Universe
- License: apache-2.0
- Created: 2022-08-29T05:34:38.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T20:39:24.000Z (8 months ago)
- Last Synced: 2024-05-15T09:36:59.190Z (6 months ago)
- Language: Python
- Homepage:
- Size: 315 KB
- Stars: 4
- Watchers: 14
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slack_command_bot component
With this app you can create a Slack bot and enable interactivity with the Slash Commands.
It can recieve slash commands and send message or files with the Slack client API.## How to Run Slack Command Bot
First, install slack_command_bot (warning: this component has not been officially approved on the lightning gallery):
```bash
lightning install component git+https://github.com/Lightning-AI/LAI-slack-messenger.git@main
```Once the app is installed, use it in an app:
```python
from slack_command_bot import SlackCommandBot
import lightning as L
import slack
from flask import requestclass DemoSlackCommandBot(SlackCommandBot):
def handle_command(self):
"""Customize this method the way you want your bot to interact with the prompt."""
client = slack.WebClient(token=self.bot_token)
data: dict = request.form
channel_id = data["channel_id"]client.chat_postMessage(text="testing post msg", channel=channel_id)
return "Hey there! command was received successfully", 200class LitApp(L.LightningFlow):
def __init__(self) -> None:
super().__init__()
self.slack_bot = DemoSlackCommandBot(command="/LAIcommand")def run(self):
print(
"this is a simple Lightning app to verify your component is working as expected"
)
self.slack_bot.run()app = L.LightningApp(LitApp())
```