I want to spin up a Slack to IRC Bridge so I can access my work Slack from silly places, like my [[Mac SE]] using Wallops IRC for System 7 (lol).
Another fun project to try would be: [GitHub - wee-slack/wee-slack: A WeeChat script for Slack.com. Supports threads and reactions, synchronizes read markers, provides typing notification, etc..](https://github.com/wee-slack/wee-slack)
## IRC Bridge
[GitHub - insomniacslk/irc-slack: IRC-to-Slack gateway](https://github.com/insomniacslk/irc-slack)
Run it with Docker: [GitHub - insomniacslk/irc-slack: IRC-to-Slack gateway](https://github.com/insomniacslk/irc-slack?tab=readme-ov-file#run-it-with-docker)
## Setup on Synology
- Login to Synology DSM as administrator.
- Open **Container Manager**.
- Click **Container**.
- Click **Create**.
- Select **Image > Add Image**.
- Search for **insomniaclk/irc-slack** and Click **Download**.
- Name the container whatever you want.
- Check **Enable resource limitation**.
- Select CPU Priority **Low**.
- Select Memory Limit of **1024MB**.
- Check **Enable Auto-Restart**.
- Click **Next**.
- Click **Add** to add a port mapping.
- Enter **6666** / **6666** / TCP.
- Select the **Bridge Network**.
- Click **Next**.
- Click **Done.**
- Make sure the container is running.
- [[Slack to IRC Bridge#Grab Slack Auth Token]]
- Use IRSSI to connect as a test.
- `brew install irssi`
- `irssi`
- `/network add YOURTEAM.slack.com`
- `/server add -auto -network YOURTEAM.slack.com SYNOLOGYIP 6666 YOURSLACKAUTHTOKEN
- `/connect YOURTEAM.slack.com`
## Grab Slack Auth Token
- Open Firefox
- Open Slack
- Login
- Open developer mode
- Go to "network" tab
- Click on "WS", that means websocket
- Select the connection, right click and copy value > copy with cURL. If there is no connection, refresh the page and it will appear.
It will be something like this:
```text
curl 'wss://wss-primary.slack.com/?token=xoxc-1111111111-111111111111-1111111111111-11111111111111111&sync_desync=1&start_args=%3Fagent%3Dclient%26org_wide_aware%3Dtrue%26agent_version%111111111111%26eac_cache_ts%3Dtrue' \
-H 'User-Agent: Mozilla/5.0' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Accept-Encoding: gzip, deflate, br' -H 'Sec-WebSocket-Version: 13' \
-H 'Origin: https://app.slack.com' \
-H 'Sec-WebSocket-Extensions: permessage-deflate' \
-H 'Sec-WebSocket-Key: 111111111111111111111111' \
-H 'DNT: 1' \
-H 'Connection: keep-alive, Upgrade' \
-H 'Cookie: b=1111111111111111; d=xoxd-1111111111111111111111111111111; tz=60; OptanonConsent=isGpcEnabled=0&datestamp=Wed+Feb+07+2024+15%3A37%3A16+GMT%2B0100+(Ora+standard+dell%E2%80%99Europa+centrale)&version=202211.1.0&isIABGlobal=false&hosts=&consentId=11111111-1111-1111-1111-111111111111&interactionCount=1&landingPath=NotLandingPage&groups=1%3A1%2C3%3A0%2C2%3A0%2C4%3A0&AwaitingReconsent=false; lc=1111111111; shown_download_ssb_modal=1; d-s=1111111111; x=11111111111111111111111111111111.1111111111' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: websocket' \
-H 'Sec-Fetch-Site: same-site' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade: websocket'
```
The `token=` part of the URL (terminated by `&`) and the `Cookie:` header are the parts that are important.
The cookie header contains more than one cookie, we want the one starting with `d=`. The value for the cookie must include the initial `d=` and the final `;`.
Then concatenate the token and the auth cookie using a `|` character, like this:
```
xoxc-XXXX|d=XXXX;
```
I like to store this in 1Password for reference.