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:

  1. Download the Telegram app to your phone.
  2. Create a Telegram bot. You can follow instructions online like here.
  3. Make a note of your bot token.
  4. Open your bot chat and send a message (your bot won't respond anything).
  5. Open your browser and go to the following website
    1. https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
      1. You should get a JSON data string.
    2. Under the fields: results -> message -> from, find the 'id' key, this is your 8 digits chat_id parameter. make a note of it.
  1. Go to MATLAB and create structure with your bot information:
    1. telegram_bot = struct('token', <YOUR TOKEN AS A STRING>, 'chat_id', <YOUR CHAT_ID AS STRING>)
  2. Save the structure with the name 'telegram_bot.mat' in the root of your mlib_devel repository:
    1. save('telegram_bot.mat', 'telegram_bot')
    2. 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.