Synology NAS Notifications to Telegram Bot

This guide will help you setup notifications from your Synology NAS sent to you via a bot in Telegram. This has been tested on Synology NAS hardware DS214se, DS1515 &  This was personally tested on DSM 6.2-23739 Update 2 and reported to work on DSM 6.1-15047.

What you’ll need:

  • Telegram Desktop
  • A Synology NAS running DSM 6.1 or newer
  • Web Browser

First lets start with Telegram. You’ll create a bot and save your bot’s API key.

  1. Create a bot
    1. In Telegram’s search box type @BotFather and click on the bot
    2. Click “Start” to start a conversation with @BotFather
    3. Type /newbot in the chat
      1. Fill in a name for the bot. This name will be the big visible name in your contacts list
      2. Fill in a username for the bot. This doesn’t really get seen so it can be almost anything.
    4. @BotFather will spew some text including your bot API key. It’s the bit after “Use this token to access the HTTP API:” formatted xxxxxxxx:xxxxxxxxxxxxxxxxxx Save it somewhere safe.
  2. Start a conversation with your bot. This forces some info to fill in the Telegram API in preparation for the next steps.
    1. Type your bot’s name in to the search field in Telegram and click on the bot.
    2. Click “Start” to start the conversation.
    3. Send a message that says anything. “Literally anything” and hit enter.

Now we need to jump over to our web browser. I did this in Firefox but the results should be the same in Chrome or really any browser.

  1. Open your web browser.
  2. Put{{{$TOKEN}}}/getUpdates in your address bar.
  3. Replace the {{{$TOKEN}}} part of the address with the API token/key from your bot creation step 1 part 4.
  4. Hit “enter” to load the address.
  5. You should receive something similar to the image above.
  6. Copy the number you find under “chat” and “id” to someplace safe and easy to reference.

Now we can put the pieces together to get your NAS talking through your bot. You’ll need to do the rest of this in your browser in the NAS interface. Since every config is different I’ll leave it to you to find your way to the DSM interface. Here we go!

  1. From the DSM desktop open “Control Panel”.
  2. Click “Notifications”
  3. Click the “SMS” tab at the top.
  4. Check the “Enable SMS notifications” box.
  5.  Click “Add SMS Service Provider”
    1. Fill in “Provider Name” with whatever you want to call the provider for your own reference. “Telegram”.
    2. Fill in “SMS Url” with:{{{bot_api_token}}}/sendMessage?chat_id={{{chat_id}}}&text=Hello+world&user=User&password=Password&to=12345678
    3. Replace {{{bot_api_token}}} with the bot API token/key from the first section #4.
    4. Replace {{{chat_id}}} with the number you received
    5. Leave HTTP as the default GET
    6. Click “Next”
  6. Leave Edit HTTP Request Header empty
  7. Click “Next”
    1. chat_id=XXXXX” should be set to “Other”
    2. text=Hello+World: should be set to “Message content”
    3. user=User: should be set to “Username”
    4. password=Password: should be set to “Password”
    5. to=12345678: should be set to “Phone number”
    6. Click Apply
  8. Finally fill in the following
    1. Username: fill in “User”
    2. Password: fill in “Password”
    3. Confirm password: “Password”
    4. Primary phone number: “555” – “5555555”
  9. Fill in “Enable SMS interval limit” if you need this.
  10. Click “Apply”
  11. Click “Send a test SMS message”

If all went well you should have a test message from your notification bot. You may also want to review the “Advanced” tab where you can have fine grain control over what notifications get sent to SMS and thus your Telegram bot.

Thanks to Martinorob here for the majority of the base instructions which I cleaned up some and revised for newer DSM versions. Also to the ForSomeDefinition blog here for how to find the chat ID with you vs Martinorob’s initial group chat configuration.

View Comments