Skip to content

This is slackApp with 3rd party app. It can be example for anyone want to create slack bot by using python.

Notifications You must be signed in to change notification settings

IT-HONGREAT/slack_bot

Repository files navigation

Slack Bot

  • Main Bot and Add Sub functions.(Any SDK or API)
Relationship Diagram v1

relationship_diagram_v1

Relationship Diagram v2

This architecture is currently used now. SlackApp and FastApi are distributed by directory. relationship_diagram_v2


Directory

└── project_name
    ├── bolt               # bolt(slack) directory
    └── notion             # notion directory

Environment

python 3.10
fastapi 0.92.0

How to start(local)

1. Set .env_temp => .env

[Required]

NOTION = <your-notion-secret-key>
SLACK_APP_TOKEN=xapp-<your-app-level-token>
SLACK_BOT_TOKEN=xoxb-<your-bot-token>

How to get token of slackapi

  • app_token(xapp)
    • SlackAPI -> Your-app -> Settings -> Basic Information
  • bot_token(xoxb)
    • SlackAPI -> Your-app -> Features -> OAuth & Permissions

[Optional]

If you need to connect to Notion Database.

NOTION_{DB_NAME}=<your-db-id>

2. Run pip install -r requirements.txt in terminal.

3. Run python main.py in terminal or IDE.

  • <main.py> process is temporary.

4. How to call your bot

1. Mention your bot by using @
    - @{bot name}

2. Use shortcut "/가이드" or "/메인봇"
    - Require to rigster shortcut of slack's app setting

5. How to Run FastAPI

uvicorn app_fastapi:api --reload --host 0.0.0.0 --port 8000 --log-level warning

Functions

No Functions Name FROM -> TO
1 회의실 예약하기 SLACK -> NOTION
2 점심메뉴추천 NOTION -> SLACK
3 예약 메세지 SLACK(BOT -> USER)
4 똑개 대나무숲 SLACK(BOT -> CHANNEL)

Deploy on AWS

AWS Lightsail Containers
1. slackbot
2. slackbot-fastapi

About

This is slackApp with 3rd party app. It can be example for anyone want to create slack bot by using python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published