Alarm notifications for all tags via Telegram

I want to send alarm notifications via Telegram for all tags configured with an alarm action (eg email). (by the way, it would be helpful if you could integrate http requests in alarm actions)
How can I catch the event of an alarm for all tags in BASIC without using ONxxxx for each tag?
How can I then send the at least tagmane/s in the notification (not as attachment)? Maybe process rt_alm.txt somehow?
Thank you

There is no way to trigger code in response to any alarm, but you can loop through all the tags and assign ONALARM for each of them like so:

SETSYS SYS, "LOAD"
C% = GETSYS PRG, "NBTAGS"
FOR i% = 0 TO (C% - 1)
  SETSYS TAG, "LOAD", -i%
  tagname$ = GETSYS TAG, "Name"
  ONALARM tagname$, "GOTO HandleAlarm"
NEXT i%
END

HandleAlarm:
  LOGEVENT "Alarm state changed"
END

To expand on this, instead of setting up a HandleAlarm label, you could create a function that takes the tag name as an argument. Then when calling ONALARM in the setup loop, specify that it calls the HandleAlarm function and passes the tag name as an argument. Finally, within that function you can configure your HTTP request to send the notification.

Note that ONALARM triggers when the alarm state changes, not just when the tag goes into alarm, so you’ll want to use ALSTAT to check the alarm state before handling it.

Information on functions can be found in section 2.3 of RG-0006-01-EN - Programming Reference Guide