I want to send a notification , once I clear the alarm manually from device management

i want to send the notification as soon as i clear the alarm manually from the device management through EPL,
please give code snippet or solution for this.

Thank yoo

@jkpatil1010 Below find the sample Code snippet

    action onload() {(){

         on all Alarm(type="c8y_TemperatureThresholdExceedAlarm", status="CLEARED") as ar {
        	 log "Received Alarm: "+ar.toString() at INFO;
    action sendEmail(Alarm alarm) {
		string subject := alarm.text;
		string text  := alarm.type;
		string emailTo := "noreply@test.com";
		sequence<string> emailReceivers := ["vachaspati.diwevedi@test.com","abc@test.com"];
		sequence<string> emailCC := [];
		string emailBCC := "";
		send SendEmail(
			new dictionary<string,string>
		) to SendEmail.SEND_CHANNEL);
		log "Email Sent" at INFO;
1 Like

Hi @Vachaspati_Diwevedi2

Thank you,

Hi @Vachaspati_Diwevedi2 ,
can you please also share , code snippet to send sms as well,
will be helpfull.

Thank you.

@jkpatil1010 , Below find the code snippet for send SMS, Always put a check to have at lease one received before calling this action for triggering SMS

/* The list of phone numbers to which the SMS is to be sent. */
sequence<string> smsReceivers := ["+919100000001"];

/** Called whenever a new matching alarm is received
	*   and an SMS has to be sent out.
	*   @param alarm The alarm giving rise to this SMS.
	action sendSMS(Alarm alarm) {
		string text  := Util.ensureSMSLength(
											Util.replacePlaceholders(smsMessage, alarm));
		send SendSMS(text, smsReceivers, alarm.source,
					new dictionary<string,string>) to SendSMS.SEND_CHANNEL;