Send message , photo , document files to Telegram

93 Likes Comment

These are some useful command for you to use a telegram bot send messages in bash shell.

Send message:

curl -s -X POST -d chat_id=CHAT_ID -d text="YOUR MESSAGE HERE"

Send Photo:

curl -F "chat_id=CHAT_ID" -F "photo=@/path/to/yourimage.png"

Send document files

curl -F document=@"path/to/yourfile"

How to get CHAT_ID for your telegrambot?

  1. Add your bot to a group , and grant the send messages to him.
  2. Chat with your bot, send a welcome message.
  3. Run the following url to get chat_id

An additional tip for you: Change your bot avatar? Just chat with botfather, and select your botname, send a photo as his avatar. That’s done.

You might like


About the Author: Toc Xoan

Leave a Reply

Your email address will not be published. Required fields are marked *