How to send url link in the message using Telegram Bot or Show a button to open the URL link
Asked Answered
I

1

5

Message text by Bot as:

Click to Open URL

URL is http://www.example.com/

reference image as: enter image description here

Infect answered 6/8, 2020 at 11:26 Comment(0)
I
19

There is two way to give the option to open the URL in bot-message by the user as:

API endpoint- https://api.telegram.org/bot{MENTION_YOUR_BOT_TOKEN*}/sendMessage

API method- GET

  1. Show URL in the message

hit the API with this raw JSON data-

{
    "chat_id" : MENTION_USER_CHAT_ID*,
    "text" : "Click to Open [URL](http://example.com)",
    "parse_mode" : "markdown"
}
  1. Show a URL button below the message

hit the API with this raw JSON data-

{
    "chat_id" : MENTION_USER_CHAT_ID*,
    "text" : "Click to Open URL",
    "parse_mode" : "markdown",
    "reply_markup" : {
        "inline_keyboard" : [
            [
                {
                    "text" : "Open link",
                    "url" : "http://example.com"
                }
            ]
        ]
   }
}

Note: replace * marked variable as per your data.

Infect answered 6/8, 2020 at 11:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.