Sending messages to the sysop via Telegram
π‘ Sending messages to the sysop via Telegram
π Description
The `msg_sysop` command allows users connected to a DXSpider node to send a direct message to the sysop via Telegram.
It is useful for:
- Requesting registration on the node
- Reporting issues or failures
- Making general enquiries
The message includes the following data:
- User callsign
- Subject (e.g. REGISTER, PROBLEM, INFO)
- Email address
- Message text
- Access IP
βΆοΈ Command usage
From the DXSpider shell:
msg_sysop <CALL> <SUBJECT> <EMAIL> <MESSAGE>
Examples
set/msg_sysop XX0ABC REGISTER xx0abc@example.com Requesting registration set/msg_sysop XX0ABC PROBLEM xx0abc@example.com My password is not working set/msg_sysop XX0ABC-1 INFO xx0abc@example.com Greetings from DM42
The user will receive a confirmation, and the sysop will receive the complete message via Telegram.
βοΈ Required configuration
To use the `msg_sysop` command, minimal setup is needed for the Telegram bot.
π File: /spider/local/Local.pm
Add the following to the end of the file, just before the final `1;`:
sub telegram { my $payload = shift; my $url = "https://api.telegram.org/bot$main::token/sendMessage"; `curl -s -X POST $url -d chat_id=$main::id -d text="$payload\n" -d parse_mode="Markdown"`; }
If `/spider/local/Local.pm` does not exist, you can copy it from the base installation:
cp /spider/perl/Local.pm /spider/local/
π File: /spider/local/DXVars.pm
Add your bot credentials at the end of the file, just before `1;`:
# Telegram Bot $id = "123456789"; $token = "89734237899:KF90V20M90MCQJA9Q0'91C,CCC'0944";
Restart the node to apply the changes:
shutdown
π¬ Notify unregistered users
To let users know that they need to register and can use the `msg_sysop` command, you can override the default DXSpider error message.
Edit `/spider/startup` and add the following lines:
set/var $DXM::msgs{en}{e28} = 'Sorry, you need to be registered (Use the msg_sysop command to request registration.)' set/var $DXM::msgs{es}{e28} = 'Lo sentimos, necesitas estar registrado (Usa el comando msg_sysop para solicitar registrarte)'
π’ Display a message in the MOTD
To remind users upon login, edit the file `/spider/local_data/motd_nor`:
+-----------------------------------------------------------------------------+ | If you wish to have full access, please use the command 'msg_sysop' | | to request registration on this node. | +-----------------------------------------------------------------------------+
π¦ Script download
You can download the `msg_sysop.pl` script from the official repository:
View on GitHub - EA3CV/dxspider_info
Save it as:
/spider/local_cmd/msg_sysop.pl
It may be helpful to look at [1]
π How to get your Telegram ID and Token
To receive messages, you need to configure a Telegram bot:
- Open Telegram and search for
@BotFather
- Start a new bot with:
/newbot
and follow the instructions - BotFather will return a token like:
1234567890:AAEjg0EjEMPLO_T0KEN4PRUEBA1234
- Send any message to your bot via Telegram
- Then open this URL in your browser (replace with your actual token):
https://api.telegram.org/bot<your_token>/getUpdates
You will see something like:
"chat":{"id":123456789,"first_name":"YourName",...}
That number is your **chat ID**. Use this ID and your token in `/spider/local/DXVars.pm`.
β οΈ Important
This script **only works with Telegram bots**. It is not possible to send messages directly to personal accounts via the Telegram API.
π§ Additional notes
- This command is designed as a lightweight and direct alternative to email.
- The sysop receives all relevant data, including the userβs IP and callsign.
- You may combine this with logging or other scripts for additional traceability.
π§βπ» Author
- Kin EA3CV* β [2](mailto:ea3cv@cronux.net)