Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send custom URL in telegram button bash

I wrote this code with bash for send Messages with telegram bot, now i need send the Message with a custom URL.

This is my actual code:

sendTelegram() {
        curl -s \
        -X POST \
        https://api.telegram.org/bot$apiToken/sendMessage \
        -d text="$download" \
        -d chat_id=$userChatId
}

How to I can send the Message $download in a URL Button, for example:

URL Button Telegram

like image 295
Jhosman Avatar asked Oct 20 '25 13:10

Jhosman


1 Answers

You need to use an inline_keyboard from reply_markup and send a POST request with a JSON content type header:

curl -d '{"chat_id":7455490, "text":"pruebax", "reply_markup": {"inline_keyboard": [[{"text":"LaResistencia.co", "url": "http://laresistencia.co"}]]} }' -H "Content-Type: application/json" -X POST https://api.telegram.org/bot$apiToken/sendMessage

Check the Telegram bot API inline_keyboard section for more info about the parameters: https://core.telegram.org/bots/api#inlinekeyboardbutton

Telegram bot bash inline_keyboard

like image 159
Cizaquita Avatar answered Oct 22 '25 09:10

Cizaquita



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!