Sample action file for Fail2Ban.
Place this file in /etc/fail2ban/action.d/ and add its name to the selected action in your jail.local file.
Action will be executed on jail start and stop and whenever an IP is banned or unbanned.
Code originally posted by Mypapit (https://blog.mypapit.net/2015/08/how-to-send-fail2ban-notification-with-telegram-telegram-cli.html).