Shinobi

How to use a Telegram Bot for Shinobi Notifications

Using the Telegram API we can get notifications about our Shinobi CCTV system. Here's how.

To do it all from the web you can open the Telegram Web Portal to get started  https://web.telegram.org/

1. Search for the user named "BotFather" and start a chat with him.

2. Type the following and press enter.

/newbot

3. BotFather will now ask the name of your bot. Name it what you want with the word "Bot" at the end, all one word.

4. BotFather will now provide the following :

  • URL to begin a chat with your bot : Click it to open the Chat with your bot.
  • Bot Token : You will need this later when enabling the Bot in Shinobi.

5. Say " hello " to your bot. (You can say anything, just send a message to your bot). This step is very important.

6. Copy the following link into your web browser and replace the value $BOT_TOKEN with the Bot Token you received during your chat with the BotFather.

7. You will see your last message to your Bot. The one sent during Step 5. Here is an example of what it may look like.

{"ok":true,"result":[{"update_id":11111111,
"message":{"message_id":2,"from":{"id":999999999,"is_bot":false,"first_name":"Moe","last_name":"A","username":"moeiscool","language_code":"en"},"chat":{"id":999999999,"first_name":"Moe","last_name":"A","username":"theTelegramUserName","type":"private"},"date":1619500143,"text":"test"}}]}

In here you will see "id". This is the Recipient ID you will use in Shinobi. In the example you can see that the ID is 999999999.

You may need to become root or the user that started the Shinobi process. Assuming your Shinobi is installed in /home/Shinobi.

cd /home/Shinobi
npm install node-telegram-bot-api
node tools/modifyConfiguration.js addToConfig='{"telegramBot":true}'
pm2 restart camera.js

You can also add  "telegramBot":true to the configuration through the Superuser panel as well.

1. Login to your Shinobi account and open the Account Settings. Navigate to the Telegram section.

2. Enable it and Input the following information :

  • Bot Token : Acquired in Step 4 of the Bot creation.
  • Recipient ID : Acquired in Step 7 of the Bot creation.

3. Save and open your Monitor Settings to see Telegram options in the Notifications section. You may need to switch from Simple to Advanced in the bottom right corner.

ShinobiDocs

All content is property of their respective owners.