Hi, I want to create a script to notify me if any of the openvpn user is connected and disconnected through telegram api. I have already have the api code but I dont know how to create a code to get information if the user is connected or disconnect. Below is the telegram api code that I have. Only the part to get whether the vpn user is connected or disconnected I dont have. Need help from mikrotik coders out there, many thanks.
# ChatID from telegram that is going to receive reports
:local chat "telegram id";
# API code from Telegram BOT
:local bot "telegram api code";
# Defining message
:local initel "https://api.telegram.org/bot";
:local endtel "&text=";
:local newline "%0D%0A";
:local who "$[/system identity get name]";
:local datetime "$[/system clock get date] $[/system clock get time]";
:local message "User din (Haziruddin) is connected to VPN";
:local messagefinal " $who REPORT$newline $newline $message $newline $newline log date: $datetime \
$newline $newline";
/tool fetch url="$initel$bot/sendMessage\?chat_id=$chat$endtel$messagefinal" keep-result=no;