|
| 1 | +# Slack Responders |
| 2 | + |
| 3 | +<div align="center"> |
| 4 | + <img src="./assets/slack-logo.png" alt="Slack Logo" width="150"/> |
| 5 | +</div> |
| 6 | + |
| 7 | +This directory contains two Slack responders for TheHive integration: |
| 8 | + |
| 9 | +1. **Slack_CreateChannel**: Creates a Slack channel for a TheHive case, invites participants, and optionally posts a case summary and description. |
| 10 | +2. **Slack_SyncChannel**: Syncs Slack channel conversations to TheHive task logs. Imports messages chronologically with file attachments for traceability. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## Features |
| 15 | + |
| 16 | +### Slack_CreateChannel |
| 17 | +- Creates a Slack channel named `case-<caseId>` (customizable prefix) |
| 18 | +- Invites default participants by email |
| 19 | +- Sets channel visibility (private or public) |
| 20 | +- Posts case summary and/or case description (optional) |
| 21 | + |
| 22 | +### Slack_SyncChannel |
| 23 | +- Retrieves all conversation history from channels with format `#case-CASEID` |
| 24 | +- Creates TheHive tasks in "Communication" category with individual task logs for each message |
| 25 | +- Downloads and attaches file attachments (images, documents) to task logs |
| 26 | +- Chronologically ordered messages with timestamps and usernames |
| 27 | +- Prevents duplicate syncing by tracking message timestamps |
| 28 | +- Converts Slack user IDs to readable usernames for better readability |
| 29 | + |
| 30 | +## Preview |
| 31 | + |
| 32 | +<div align="center"> |
| 33 | + <a href="./assets/slack-history.png" target="_blank"> |
| 34 | + <img src="./assets/slack-history.png" alt="Slack History" width="300" style="margin: 10px;"/> |
| 35 | + </a> |
| 36 | + <a href="./assets/thehive-slacksync-1.png" target="_blank"> |
| 37 | + <img src="./assets/thehive-slacksync-1.png" alt="TheHive Slack Sync 1" width="300" style="margin: 10px;"/> |
| 38 | + </a> |
| 39 | + <a href="./assets/thehive-slacksync-2.png" target="_blank"> |
| 40 | + <img src="./assets/thehive-slacksync-2.png" alt="TheHive Slack Sync 2" width="300" style="margin: 10px;"/> |
| 41 | + </a> |
| 42 | +</div> |
| 43 | +--- |
| 44 | + |
| 45 | +## Requirements |
| 46 | + |
| 47 | +- A Slack workspace where you have permissions to create a bot. |
| 48 | +- Your bot must be allowed to create channels and invite users. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## 1. Create a Slack App & Bot Token |
| 53 | + |
| 54 | +1. Go to [Slack API: Your Apps](https://api.slack.com/apps) and click **"Create New App"**. |
| 55 | +2. Choose **From scratch**, name your app, and pick your workspace. |
| 56 | +3. Under **Features**, click **OAuth & Permissions**. |
| 57 | +4. **Add these OAuth scopes** under **Bot Token Scopes**: |
| 58 | + |
| 59 | + **For Slack_CreateChannel:** |
| 60 | + - `groups:write` - Manage private channels that your slack app has been added to and create new ones |
| 61 | + - `groups:write.invites` - Invite members to private channels |
| 62 | + - `groups:write.topic` - Set the description of private channels |
| 63 | + - `groups:read` - View basic information about private channels that your slack app has been added to |
| 64 | + - `users:read.email` - Look up user IDs by email |
| 65 | + - `chat:write` — Send messages as the bot |
| 66 | + |
| 67 | + **For Slack_SyncChannel (additional scopes required):** |
| 68 | + - `channels:history` - Read messages in public channels |
| 69 | + - `groups:history` - View messages and other content in private channels that your slack app has been added to |
| 70 | + - `channels:read` - View basic information about public channels |
| 71 | + - `files:read` - Access file content and info (for downloading attachments) |
| 72 | + - `users:read` - View people in a workspace (for username conversion) |
| 73 | + |
| 74 | + **⚠️ Important for File Downloads:** |
| 75 | + - Your Slack bot must be **added to the channel** where files were shared |
| 76 | + - Files shared before the bot was added may not be downloadable |
| 77 | + - Private files require the bot to have proper permissions |
| 78 | + |
| 79 | +5. **Install the app to your workspace** (top right: "Install to Workspace"). |
| 80 | +6. After install, **copy your Bot User OAuth Token** (starts with `xoxb-...`). |
| 81 | + |
| 82 | +***Note: don't forget to reinstall your app to workspace to refresh permissions of your BOT.*** |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## 2. Enable and configure the Responders |
| 87 | + |
| 88 | +Log into your Cortex instance, go to Organization > Responders and enable the desired JIRA responders with the appropriate configuration & API keys. |
| 89 | + |
0 commit comments