Skip to content

strbagus/unitele

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Universal Telegram Bot

A simple, self-hosted Go application that provides a universal HTTP endpoint to send messages to a specific Telegram chat. This is ideal for sending notifications, logs, or alerts from various services within a home network or cluster.

Features

  • Single, lightweight Go file with no external dependencies.
  • Listens on 0.0.0.0 to be accessible from any node on the network.
  • Simple query parameter-based API (/sendMessage?message=...&code=...).
  • Placeholder for simple secret code authentication.

Prerequisites

  • Go (version 1.18 or later recommended).
  • A Telegram account.

Setup

  1. Create a Telegram Bot:

    • Open Telegram and start a chat with @BotFather.
    • Send the /newbot command and follow the instructions.
    • BotFather will give you a Bot Token. Keep this safe.
  2. Get your Chat ID:

    • Start a chat with your new bot.
    • Then, start a chat with a bot like @userinfobot.
    • It will immediately reply with your user information, including your Chat ID.
  3. Configure the Application:

    • Copy paste .env.example to .env.
    • FIll the values for TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, SECRET_CODE, and HTTP_PORT with your actual credentials.

Usage

To send a message, make an HTTP GET request to the /sendMessage endpoint from any service or client on your network.

Endpoint

GET /sendMessage

Query Parameters

  • message (string, required): The text message you want to send.
  • code (string, optional): The secret authentication code.

Example using cURL

Replace <YOUR_SERVER_IP> with the IP address of the machine running the bot.

curl "http://<YOUR_SERVER_IP>:8080/sendMessage?message=Disk%20space%20is%20getting%20low%20on%20server-01&code=a-very-strong-and-secret-password"

If the message is sent successfully, you will receive a "Message sent successfully." response.

About

simple endpoint for sent message to telegram that can be requested from any services & nodes from my network.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages