Shinobi
Home  /  Notifications  /  Discord

How to setup Push Notifications with Discord Bot API

Using the discord.js bot library we can get push notifications to Desktop and Mobile!

Since its easier to read over the instructions from Discord themselves. Here is a link to that. After creating your server you can continue this tutorial.

https://support.discordapp.com/hc/en-us/articles/204849977-How-do-I-create-a-server-

To keep your server private; don't share any permanent invite links.

Assuming your Shinobi is installed in /home/Shinobi you can run the following commands to enable the feature.

Essentially just installing the Discord.js Node.js module and adding  "discordBot":true to the conf.json.

cd /home/Shinobi
npm install discord.js
node tools/modifyConfiguration.js addToConfig='{"discordBot":true}'
pm2 restart camera.js

1. Open the  My Apps  page and click New App . Name the application, we'll call ours Navi. You can ignore "Redirect URI(s)" unless you know what they are for.

2. On the Application page you can Create a Bot User . This bot will sit in your private Discord community with the App name as its Username. Ours will appear as Navi.

3. Now the section displays a link to Reveal your   Token . This is the Token that allows you to login to your Bot via the API. Do not share this key with anyone.

Keep this tab available, you will need to copy and paste the Token later.

4. Above you can see the button Generate OAuth2 URL . Click that to reveal a link to authorize your bot.

5. Open the link in a new tab.

6. You will be greeted with the option to Authorize your bot.

Now you should see your bot in the user list of your server. It will appear offline until you have connected it with Shinobi.

7. Now to get the Channel ID of your Discord Channel. Open your Discord Account settings by clicking the gear icon .

8. Open the Appearance page and enable Developer Mode . Save and go back to your Discord Channel.

9. Now right click your Discord Channel and click Copy ID .

10. Now that you have a Discord Bot Token and a Discord Channel ID  open your Shinobi panel in a new tab and open the Account Settings to Input the Token and Channel ID.

11. After pressing Save your bot will become active.

12. Now you will find the option to send Discord Alerts in your Monitor Settings window in the Notifications section.

Now you should see Notifications appearing as follows in your Discord channel.

ShinobiDocs

All content is property of their respective owners.