Jhosman
Jhosman

Reputation: 555

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

Upvotes: 4

Views: 12610

Answers (2)

Cizaquita
Cizaquita

Reputation: 167

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

Upvotes: 8

Sean Wei
Sean Wei

Reputation: 7975

Please use reply_markup like this payload.

Upvotes: 2

Related Questions