Send to Telegram

Send from web to telegram using script

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
Tommy Trinh
日安装量
0
总安装量
2
评分
0 0 0
版本
1.0
创建于
2025-09-15
更新于
2025-09-15
大小
1.7 KB
许可证
MIT
适用于
所有网站

Instructions

1. Requirements

  • Install a userscript manager such as Tampermonkey or Violentmonkey in your browser.
  • Have a Telegram Bot Token and Chat ID ready:
    • Create a bot via @BotFather on Telegram to get your BOT_TOKEN.
    • Find your CHAT_ID using this guide.

2. Installation

  1. Click the Install button on this script’s Greasy Fork page.
  2. Open the installed script in your userscript manager.
  3. Replace: js const BOT_TOKEN = "enter_bot_token_here"; const CHAT_ID = "enter_chat_id_here"; with your actual bot token and chat ID.

3. How it works

The script listens for window.postMessage events from the Zalo Web page.

When it receives a message with the matching type you define, it extracts:

  • Sender name (dName)
  • Message content (content)

It then sends this information to your Telegram chat via the Telegram Bot API.


4. Sending data to the script

From another script or injected code on the Zalo Web page, post a message like this:

window.postMessage({
    type: "DEFINE-YOUR-TYPE-HERE", // Must match the type you set in the script
    payload: parsedZaloData // The parsed JSON object containing message data
}, "*");

Replace "DEFINE-YOUR-TYPE-HERE" with the same string you put in in the script.


5. Example payload


{
  "data": {
    "msgs": [
      {
        "dName": "John Doe",
        "content": "Hello from Zalo!"
      }
    ]
  }
}