Light weight text channel bridge between Slack & Discord.
Utilises Slack Events API & Web API, no more creating "old" slack apps & using deprecated RTM libraries.
Credit to @HackSoc for original inspiration.
Before installation please ensure you have Node.js and NPM installed on your machine.
Step 1: Clone repository & install dependency packages.
git clone https://github.com/NickMandylas/slack-discord-bridge
cd slack-discord-bridge
npm install
Step 2: Setup Slack App / API Keys.
-
Head to Slack API and create an app.
-
Go to Basic Information (if not already there) and save the
signing secret
toslack.keys.js
. -
Go to OAuth & Permissions and scroll down to scopes & add the following:
- Bot Token Scopes:
chat:write
,chat:write.customize
&users:read
. - User Token Scopes:
channels:history
- Bot Token Scopes:
-
Still on the OAuth & Permissions page, scroll to the top and click
Install App to Workspace
. Proceed through the installation prompts. This will provide you yourOAuth Access Token
&Bot User OAuth Access Token
. Add these tokens to yourslack.keys.js
file. -
Go to Events Subscriptions & complete the following:
-
Turn On
Enable Events. -
Click
Subscribe to events on behalf of users
& addmessage.channels
to the permission scope. -
We now need to verify our request URL. Run this command in the slack-discord-bridge folder:
./node_modules/.bin/slack-verify --secret <signing_secret> --port=80
.
Replace <signing_secret> with your signing secret that was retrieved from step 2.
Then enter in http:///slack/events to the Request URL.
Once verified you can stop the script.
-
Step 3: Setup Discord Bot / API Keys.
-
Head over to Discord Developers Page & create a new application.
-
On the side panel, click Bot. Add a new bot & copy the Token to
Discord.keys.js
. -
On the side panel, click OAuth2. We'll create a link to invite our bot to our server.
- Tick the
bot
checkbox under scopes. - Tick the
Read Message History
permission. - Copy the URL above, and paste it into your browser. This will open a prompt to add the bot to your server.
- Tick the
-
Now we'll create a web hook for the discord channel receiving the slack message.
- Click
Edit Channel
(the gear icon next to the channel name). - On the side panel, click Webhooks add create a Webhook.
- Copy the Webhook URL, and paste the Webhook ID & token into the relevant fields in the
Discord.keys.js
file.
- Click
Step 4: Set the channels that'll be the bridge in both the Discord.keys.js
& Slack.keys.js
file.
npm start
If you need to run the application in the background, please install pm2 & run.
pm2 start index.js
Bugs / Todos
- Currently if you @ a user on either Discord or Slack, it returns the user ID, not the string.
- File sharing
Using on your local machine?
Don't have access to a public IP address? Or is port 80 blocked? Use & install ngrok.
- Run
ngrok http 3000
. - You'll need to change the port to 3000 in index.js.
- As well run this command
./node_modules/.bin/slack-verify --secret <signing_secret> --port=3000
using port 3000.
Slack delve more into using ngrok in their events-api documentation.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.