Read the CustomSmsMessage alarm property from a com.inductiveautomation.ignition.alarming.notification.NotificationContext

In a module (derived from the Slack Notification SDK example),
I would like to read the “CustomSmsMessage” (and email message and subject) alarm property from a com.inductiveautomation.ignition.alarming.notification.NotificationContext

String customMessage = notificationContext.getAlarmEvents().get(0).get(XXX);

Technically, you should mark your module as requiring the Airlink SMS module, and then you would have access to com.inductiveautomation.ignition.alarming.notification.sms.profile.SmsProperties.CUSTOM_MESSAGE directly to import.
In practice, CUSTOM_MESSAGE is just a string-typed property; I think you could either make your own BasicAlarmProperty with the same name, or just iterate through the properties on the NotificationContext; which, as a PropertySet, implements Iterable - so you can use a regular for loop:

for (PropertyValue propertyValue : notificationContext.getAlarmEvents().get(0)) {
            if (propertyValue.getProperty().getName().equals("SmsCustomMessage")) {
                String message = (String) propertyValue.getValue();
            }
        }
2 Likes

Ok, Thanks a lot !

I will try to use the same prop name and avoid the dependency with airlink module, check if the prop doesn’t exist during my module startup before using context.getAlarmManager().registerExtendedConfigProperties.

I suppose I can do the same with email/subject alarm prop ?
Those props are created by Alarm-notification module ?

com.inductiveautomation.ignition.alarming.notification.email.EmailProperties is the file - the SDK example should have that as a dependency already.