Here are some examples on how to use Telegram bot api via curl
Environment variables used, feel free to replace with bare text
- Create a bot using @BotFather, get it's token
- Start conversation with bot
- Go to @getmyid_bot and obtain your account id
Now you can send messages to yourself in a chat with bot:
Send document from disk
curl -X POST -H "Content-Type:multipart/form-data" -F document=@"path/to/some.file" "https://api.telegram.org/bot$TOKEN/sendDocument?chat_id=$CHAT_ID"
Create qr code from string, pipe stdout to curl, send it as an image
qrencode -s 6 -o - "Some text to encode" | curl -X POST -H "Content-Type:multipart/form-data" -F photo=@- "https://api.telegram.org/bot$TOKEN/sendPhoto?chat_id=$CHAT_ID"
More message types could be found here