Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions CONFIG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Slack Thread Summarizer - Configuration Guide

## Features

### 1. Summary Formats
Users can choose how they want summaries formatted:
- **Bullets** (default): `β€’ Point 1\nβ€’ Point 2\n...`
- **Numbered**: `1. Point 1\n2. Point 2\n...`
- **Paragraphs**: Full paragraph summaries
- **JSON**: Structured format with "point" and "explanation" fields

### 2. Summary Lengths
Summaries can be customized by length:
- **Brief**: 3 key points
- **Normal**: 5 key points (default)
- **Detailed**: 10 key points

### 3. Multi-Language Support
Summaries can be generated in multiple languages:
- **en**: English
- **tr**: Turkish
- **es**: Spanish
- **fr**: French
- **de**: German

### 4. Reaction Triggers
Different reactions trigger different default behaviors:
- **πŸ“ memo**: Normal 5-point summary
- **πŸ“° newspaper**: Detailed 10-point summary
- **πŸ“Œ pushpin**: Brief 3-point summary

### 5. Message Filtering
Users can exclude certain message types:
- **Filter bots**: Skip messages from bot users
- **Filter system messages**: Skip channel join/leave events

### 6. User Preferences
Each user's preferences are stored in `user_preferences.json`:
```json
{
"U123456789": {
"default_format": "bullets",
"default_length": "normal",
"default_language": "en",
"filter_bots": true,
"filter_system": true
}
}
```

## Commands

### `/summary-settings`
View your current summary preferences.

```
/summary-settings
```

Output:
```
Your Summary Settings:
β€’ Format: bullets (bullets, numbered, paragraphs, json)
β€’ Length: normal (brief, normal, detailed)
β€’ Language: en (en, tr, es, fr, de)
β€’ Filter bots: true
β€’ Filter system messages: true
```

### `/summary-set <setting> <value>`
Update a specific setting.

Examples:
```
/summary-set format json
/summary-set length detailed
/summary-set language tr
/summary-set filter-bots false
/summary-set filter-system false
```

## How to Use

1. **React to a message** in a thread with one of the configured emojis:
- πŸ“ for standard summary
- πŸ“° for detailed summary
- πŸ“Œ for brief summary

2. **Bot processes the thread** using your saved preferences

3. **Summary is posted** as a reply in the same thread

4. **Customize settings** anytime with `/summary-set` commands

## Environment Variables

Required in `.env` file:
```
SLACK_BOT_TOKEN=xoxb-...
SLACK_APP_TOKEN=xapp-...
CEREBRAS_API_KEY=csk-...
```

## Slack App Permissions

Ensure your Slack app has these permissions:
- `reactions:read` - Read reactions
- `chat:write` - Post messages
- `channels:history` - Read channel messages
- `commands` - Use slash commands

## Error Handling

- If no messages remain after filtering, the bot notifies the user
- If Cerebras API fails, the bot posts an error message to the thread
- All errors are logged for debugging

## File Storage

- `user_preferences.json`: Stores user configuration
- Created automatically on first run
- In production, consider using a database instead
82 changes: 82 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Example Usage and Test Cases

## Test Scenario 1: Default Summary (πŸ“)
**Setup:** User hasn't configured preferences
**Action:** User reacts with πŸ“ emoji to a thread message
**Expected:** 5-point bullet-point summary in English

## Test Scenario 2: Custom Format (Numbered)
**Setup:** User runs `/summary-set format numbered`
**Action:** User reacts with πŸ“ emoji
**Expected:** 5-point numbered summary instead of bullets

## Test Scenario 3: Different Language
**Setup:**
- `/summary-set language tr` (Turkish)
- `/summary-set length brief` (3 points)
**Action:** User reacts with πŸ“ emoji to a thread
**Expected:** 3-point Turkish summary

## Test Scenario 4: Detailed Summary (πŸ“°)
**Setup:** Default settings
**Action:** User reacts with πŸ“° emoji (newspaper)
**Expected:** 10-point detailed summary

## Test Scenario 5: Brief Summary (πŸ“Œ)
**Setup:** Default settings
**Action:** User reacts with πŸ“Œ emoji (pushpin)
**Expected:** 3-point brief summary

## Test Scenario 6: JSON Format
**Setup:** `/summary-set format json`
**Action:** User reacts with πŸ“ emoji
**Expected:** JSON response with structured point and explanation fields

## Test Scenario 7: Bot Filtering
**Setup:** `/summary-set filter-bots true`
**Action:** Thread has both user and bot messages, react with πŸ“
**Expected:** Summary excludes bot messages

## Test Scenario 8: System Message Filtering
**Setup:** `/summary-set filter-system true`
**Action:** Thread has system messages (channel_join, etc.), react with πŸ“
**Expected:** Summary excludes system messages

## Test Scenario 9: View Settings
**Setup:** User has customized multiple settings
**Action:** User runs `/summary-settings`
**Expected:** Shows all current settings

## Test Scenario 10: Error Handling
**Setup:** Empty thread (all messages filtered out)
**Action:** User reacts with πŸ“ emoji
**Expected:** Bot posts message "No messages found to summarize after filtering."

## Sample User Preferences File

```json
{
"U123456789": {
"default_format": "numbered",
"default_length": "detailed",
"default_language": "tr",
"filter_bots": true,
"filter_system": true
},
"U987654321": {
"default_format": "json",
"default_length": "brief",
"default_language": "en",
"filter_bots": false,
"filter_system": true
}
}
```

## Running Tests

1. Set up your Slack workspace and bot tokens
2. Deploy the bot
3. Run through each scenario manually
4. Verify `user_preferences.json` is created and updated
5. Check logs for any errors
Loading