Good morning, or good evening
For the last 3-4 weeks, I've been tinkering a bit with projeqtor for my brother. He wanted some new features so I had a go.One of them was a way to send notifications to users in a better way than mails. Indeed, he didn't really like the idea of receiving several emails for simple notifications such a ticket's state change. So I added a few lines to the "SqlElement.php" file so that, when sending mails, it first checks if the person has a custom field containing their Telegram id, and if so, sends the notification via Telegram.
However, I know that it won't be easy to maitain this feature trhough the future versions since I modified one of the main files, so I was wandering if it was possible to make it as a plugin. I've attached the modified file (for projeqtor v9.0.5). I've also used node-red to manage the bot in order to redirect new messages to a script (also attached as "telegram_bot.php").
Configuration:
- First, add two custom fields to the Resource class: an "idTelegram" field (varchar) to store the telegram id (like "@ARandomId") and a chatIdTelegram field (varchar). Both need to be visible and you can put chatIdTelegram as readonly.
- In SqlElement.php: You just need to replace "YOUR_URL" with the url of your server and "YOUR_BOT_TOKEN" with your Telegram bot token.
- In telegram_bot.php: You need to replace "USER:PWD" with a valid projeqtor user and password, "YOUR_API_KEY" with the corresponding API key, "YOUR_URL" with the url of your server and "YOUR_BOT_TOKEN" with your Telegram bot token.
You can also change the message at the end of "telegram_bot.php" in the $msg variable (I wrote them in french sry).
Does this seem to be a good enough idea to make it a plugin ?
Anyway, I hope this will help others and maybe reach your interest