SQLTelebot is an SQLMessenger plugin. With this plugin, you can send messages to Telegram contacts, groups, or channels from your database with SQL statements.
SQLTelebot supports sending Telegram messages from the following databases:
SQLTelebot supports sending text messages, images, and files.
In addition to sending messages from database, SQLTelebot also offers the following features:
This document demonstrates how to send Telegram messages from a PostgreSQL database.
First, download the script for your database type, then run the script in your database to create the interface tables (telebot_send_message and telebot_send_message_h).
Download link: https://www.sqlmessenger.com/manual/plugin-2-interface-table-config.htm#part2

Create the interface tables in your database
Click here for more details about the interface tables.
After the interface tables have been created, add your database to the SQLTelebot monitoring list.

Once configured, SQLTelebot will periodically read the telebot_send_message table based on the Polling Interval setting. If new records are found, SQLTelebot will add them to the Outgoing Messages list and send them to the specified Telegram contacts.
After SQLTelebot is properly configured, you can insert messages into the telebot_send_message table using SQL statements. SQLTelebot will send the inserted records to the corresponding Telegram recipients.
The following SQL statement sends a text message to a Telegram group.
Below is the message received in Telegram.

Note: For security reasons, any image file you plan to send must be copied in advance to the userfiles folder (or any of its subfolders) under the SQLMessenger installation directory.

You can view the SQLMessenger installation directory in the “About” dialog.


Viewing the SQLMessenger installation directory
The following SQL statement sends an image to a Telegram group. Note that the message_type field must be set to "photo", and attach_file_name must contain the full file path of the image.

The photo received in Telegram
The following SQL statement sends a file to a Telegram group. Note that the message_type field must be set to "document", and attach_file_name must contain the full file path of the file. (As with images, the file must first be copied to the userfiles folder under the SQLMessenger installation directory or one of its subfolders.)

The file must be placed in the userfiles folder under the SQLMessenger installation directory

The file received in Telegram
After SQLTelebot sends a message, it updates the state field in table telebot_send_message , and then moves the message record from telebot_send_message to telebot_send_message_h.
You can check the delivery result by querying the state and status_desc fields in the telebot_send_message_h table. For example:
The state field indicates the message delivery status. Possible values include:
|
W |
Waiting to be processed. SQLTelebot has not yet read this record. |
|
T |
SQLTelebot has read this record and is currently processing it. |
|
F |
Failed to send. The status_desc field contains the reason for the failure. |
For detailed information about telebot_send_message and telebot_send_message_h, please visit: https://www.sqlmessenger.com/manual/plugin-2-interface-table-config.htm#part4
If you run into any issues while using SQLTelebot, feel free to contact us for technical support.
SQLMessenger can also be used to automate a variety of tasks. Here are some examples:
From Manual to Automated: Improving Report Workflow with SQLMessenger
From Hours of Manual Work to One-Click Reports
Automating Data Workflows with SQLMessenger
From 90 Minutes of Manual Work to One Click: How SQLMessenger Transformed Employee’s Workflow
Automated Email List Cleanup with SQLMessenger and Gemini AI
Transforming Manual Alert Management into an Automated Workflow