Send message to a telegram group with nodejs

requirements:

telegram_msg.js script

Browse to https://web.telegram.com and start a chat with botfather type / and create a new bot, get the bots api token

add the apitoken to line 8 of the telegram_msg.js script

Add your new bot to the group you want to message

Send a message you the group in the web interface.

Now we need to find the groups chatid,

Browse to: https://api.telegram.org/botXXX:YYYY/getUpdates

replace XXX;YYYY with the api you received above

In the output you should see the chat id in the json return above:

now you can run

node telegram_msg.js <chatid> “testing”

and the message testing will get sent to the group

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s