如何将 URL 方案发送到电报以便用户可以单击它

问题描述 投票:0回答:1

我正在制作一个机器人,机器人需要向用户发送一个 URL 方案:

appname://product?pId=(blahblah)

我正在尝试使用 Markdown,我已经发送了这样的:

[Open App](appname://product?pId=(blahblah)
,我在消息中收到的是
Open App
,没有链接。
另外,只是发送
appname://product?pId=(blahblah)
并没有设置为URL,就像普通消息一样,所以我无法在消息中打开它。

有什么方法可以将该应用程序链接发送到电报消息,然后用户只需单击即可打开?

url telegram telegram-bot url-scheme
1个回答
0
投票

简介

我会尝试像你一样做。正如您所写:

[Open App](appname://product?pId=blahblah)

如果这不起作用,则需要解决方法。 我唯一能想到的就是向用户发送一个普通的网页链接,指向您自己的网站。

然后将 url-schema 作为重定向嵌入到元标记中。

示例解决方案

创建一个简单的 HTML 页面,重定向到您应用程序的 URL 方案。

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="refresh" content="0;url=appname://product?pId=blahblah">
</head>
<body>
    <p>If you are not redirected, <a href="appname://product?pId=blahblah">click here</a>.</p>
</body>
</html>

将此 HTML 页面托管在您的网络服务器上。

在您的 Telegram 消息中分享此托管 HTML 页面的 URL。

消息示例:

[Open App](https://yourwebsite.com/redirect.html)
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.