Telegram Notifications for Compilations
In our own branch of the CASPER tools (https://github.com/FrancoCalan/mlib_devel/tree/roach2) we added a feature that allows MATLAB to notify you whenever model a compilation started, is completed, or failed the compilation, via a bot from the Telegram messaging app. This is very useful because you can receive real-time notifications of your compilation status in your phone. To activate this feature follow these steps:
- Download the Telegram app to your phone.
- Create a Telegram bot. You can follow instructions online like here.
- Make a note of your bot token.
- Open your bot chat and send a message (your bot won't respond anything).
- Open your browser and go to the following website
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
- You should get a JSON data string.
- Under the fields: results -> message -> from, find the 'id' key, this is your 8 digits chat_id parameter. make a note of it.
- Go to MATLAB and create structure with your bot information:
telegram_bot = struct('token', <YOUR TOKEN AS A STRING>, 'chat_id', <YOUR CHAT_ID AS STRING>)
- Save the structure with the name 'telegram_bot.mat' in the root of your mlib_devel repository:
save('telegram_bot.mat', 'telegram_bot')
- Note: make sure to use the same names for the struct keys, and the .mat file. Also make user to save the .mat in the root of the mlib_devel folder.
That should be it. You can test your bot by compiling a model. It should send you a message when you start the compilation, and when it finishes or fails.