Sending a notification message to Telegram via cURL

Mohan pd.
Written by Mohan pd. on
Sending a notification message to Telegram via cURL

Here is the simple way to send a notification to telegram using cURL. Recently, I need to implement this on project as deployment success notification. Here is, How I manage to do it.


  • Create a bot
  • Get a token [API TOKEN] from help of url above.
  • Needs a id of a chat [group/channel on which the message will appear.]
    1. Add your bot to the chat
    2. Fetch bot updates and look for the chat id:
      shell curl$TELEGRAM_BOT_TOKEN/getUpdates | jq
    3. OR run ruby script below also your bot the chat. The chat id will appear in bot.rb’s output.

         require 'logger'
         require 'telegram_bot'
         bot = TELEGRAM_BOT_TOKEN, logger:
         bot.get_updates(fail_silently: true) do |message|
           puts "@#{message.from.username}: #{message.text}"
           puts "Chat-ID: #{}"
  • Send a message via their HTTP API:
    curl -X POST \
       -H 'Content-Type: application/json' \
       -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' \$TELEGRAM_BOT_TOKEN/sendMessage
Mohan pd.

Mohan pd.

Author of The Coders Blog. Also a professional fullstack javascript developer working with various tech company and client around world.


comments powered by Disqus