How to send Telegram Messages from shell script

Using the WhatsMate Telegram Gateway REST API

This article shows you how to send a Telegram message from a shell script.

Before the recipient can receive your Telegram message, she will need to register with the WhatsMate Telegram Gateway. Instructions are available on the official site. Unregistered users will never receive messages from the Gateway.

To send a Telegram message from a shell script, do this:

  1. Copy the following source code to your script.
  2. Customize the TODO lines:
    • Specify your Telegram gateway instance ID on line 3.
    • Specify your Client ID and Secret on lines 4 and 5.
    • Specify your target recipient on line 10. Remember to include the country code.
    • Specify your message on line 11.
  3. Make your script executable: chmod 755
  4. Run the script to send your message: ./

You will need a trial account to call the above API. Go sign up now.