https://github.com/gs1068/fast-api-slack-gpt-bot
This bot is a service that analyzes Slack thread messages and automatically generates responses using ChatGPT. It is built with FastAPI and follows Domain-Driven Design (DDD). Its main use cases include improving team communication efficiency and automating question responses.
https://github.com/gs1068/fast-api-slack-gpt-bot
ddd fastapi gpt-4 python slack spreadsheet
Last synced: 2 months ago
JSON representation
This bot is a service that analyzes Slack thread messages and automatically generates responses using ChatGPT. It is built with FastAPI and follows Domain-Driven Design (DDD). Its main use cases include improving team communication efficiency and automating question responses.
- Host: GitHub
- URL: https://github.com/gs1068/fast-api-slack-gpt-bot
- Owner: gs1068
- Created: 2024-12-05T07:50:17.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-01-01T11:20:01.000Z (5 months ago)
- Last Synced: 2025-02-01T14:17:26.056Z (4 months ago)
- Topics: ddd, fastapi, gpt-4, python, slack, spreadsheet
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Slack GPT Bot
## ディレクトリ構成
```
├── Dockerfile
├── Makefile
├── README.md
├── config
│ └── load_env.py
├── domain
│ ├── model
│ │ ├── gpt.py
│ │ ├── slack.py
│ │ └── spreadsheet.py
│ └── repository
│ ├── gpt.py
│ ├── slack.py
│ └── spreadsheet.py
├── infrastructure
│ ├── __init__.py
│ ├── gpt
│ │ └── gpt.py
│ ├── slack
│ │ └── slack.py
│ └── spreadsheet
│ └── spreadsheet.py
├── interfaces
│ ├── __init__.py
│ ├── gpt.py
│ └── slack.py
├── main.py
├── requirements.txt
├── router
│ ├── __init__.py
│ ├── gpt.py
│ ├── ping.py
│ └── slack.py
└── usecase
├── __init__.py
├── gpt.py
└── slack.py
```## インフラ構成

### 使用技術
- **言語**: Python(FastAPI)
- **API**:
- Slack API
- OpenAI GPT API
- Google Spreadsheet API
- **インフラ**:
- Docker
- ECR
- AWS App Runner
## Slack APP
OAuth & Permissions
- app_mentions:read
- channels:history
- channels:read
- chat:write
- groups:history
- groups:read
- im:history
- im:read
- im:writeEvent Subscription
- app_mention
- message.im## スプレッドシート
GCPでこのプロジェクトを作成し、credential.jsonを取得
プレッドシートの作成とActivityタブを作る最終利用日時が変わると「一日のトークン使用量」がリセットされる。

## 環境設定
### `.env` ファイル
以下の環境変数を設定してください。
```plaintext
SLACK_BOT_TOKEN="xoxb-xxxx-xxxx-xxxx-xxxx"
OPENAI_API_KEY="sk-xxxx-xxxx-xxxx-xxxx"
SPREADSHEET_ID="xxxx-xxxx-xxxx-xxxx-xxxx"
GOOGLE_CREDENTIALS_PATH="./credential.json"
```GCP から取得した `credentials.json` ファイルを `./` ディレクトリに配置してください。