Send message , photo , document files to Telegram

68 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

This guy likes taking photos, hunting cheap tours, exploring the unique culture of every cities of Vietnam. Contact: [email protected]. I've created a dogecoin wallet to receive blog funding: DE6F5FisSCy7yz5rpHY1ChMSGYnDMpFZ1Q

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.