To send and receive messages to/from telegram bot natively with MS SQL server (by stored procedures)
- SQL Server 2016 or higher
- Registered Telegram bot check here via Bot Father
- Clone repo
git clone https://github.com/gleberof/SQL-telegram-bot.git
- Run setup.sql (new DB [telegram] with all nesessary procedures will be created)
- Send a message to your bot directly in Telegram (it will help to identify your chat ID). If you're going to use the bot within a group - you need to set up the bot as one of the admins of that group.
- Open
Configure.sql
. Set bot_token given by Bot Father. It will automatically assign chat_id from the last message to the bot or chat.
- Send a message from SQL by
EXEC [dbo].[usp_SendMessage] @message = N'Hello World!'
- Run
Jobs.sql
- to enable jobs - Setup commands.
Please check [telegram].[dbo].[commands]
table to learn how to configure new commands (we setup few during initial setup)
- Setup progress bar for backups. It's almost confugured and run by job (please try backup on you server)
- Execute SQL selects. It's almost ready to execute commands - put
*
symbol before select.
- Setup monitoring. Please check
[telegram].[monitor].[threshold]
to change threshold for alerts
Please do not hesitate to address us in case of questions if any:
- gleberof @ gmail.com
- efremovfedorofficial @ gmail.com