/chatlogger

Telegram Private Chat Logger.

Primary LanguageJavaScriptMIT LicenseMIT

Chat 🔐 Logger

Telegram private chat logger (using telegram business chatbots API) on cloudflare workers.


💭 Why?

  • Prevent data loss when users delete the chat for both sides.
  • Maintain an organized and searchable record of all conversations.

🗂 Variables

const BOT_TOKEN = "BOT_TOKEN"; // Insert your bot token.
const BOT_WEBHOOK = "/endpoint"; // Let it be as it is.
const BOT_SECRET = "BOT_SECRET"; // Insert a powerful secret text (only [A-Z, a-z, 0-9, _, -] are allowed).
const BOT_OWNER = 123456789; // Insert your telegram account id.

Setup:

  • Get BOT_TOKEN from @botfather.
    • Enable business mode from botfather bot settings > business mode.
    • Add your bot as third-party chatbot in your telegram account settings > telegram business > chatbots.
  • Change BOT_WEBHOOK with your preferred webhook.
  • Change BOT_SECRET with a powerful secret text (only [A-Z, a-z, 0-9, _, -] are allowed).
  • Get BOT_OWNER from @idbot.

⚙️Deploy

  • Create a Cloudflare account.
  • Navigate to Workers & Pages > Create > Create Worker.
  • Deploy the worker by clicking Deploy.
  • Edit the code by clicking Edit Code.
  • Upload worker.js into Cloudflare.
  • Modify the variables.
  • Finally, Deploy.

Deploy to Cloudflare Workers

Setup:

  • Once you deployed the bot on Cloudflare.
  • Check XXX.XXXX.workers.dev/getMe to verify your bot authorization.
  • Open XXX.XXXX.workers.dev/registerWebhook to register your bot webhook.
  • Now your bot will log every type of private message.

🔗 Contributing

Contributions are welcome! Feel free to submit a pull request or report an issue.


🔎 License

MIT License

Copyright (c) 2025 Vauth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.