# Heartbeat messages - alarm

**URL:** <https://forums.losant.com/t/heartbeat-messages-alarm/2615>\
**Category:** Help\
**Tags:** workflow\
**Created:** [February 5, 2020, 2:56am UTC](https://forums.losant.com/t/heartbeat-messages-alarm/2615 "2020-02-05T02:56:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Bell](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/josh_bell/32/2554_2.png) [@Josh\_Bell](https://forums.losant.com/u/Josh_Bell)\
**Post date:** [February 5, 2020, 2:56am UTC](https://forums.losant.com/t/heartbeat-messages-alarm/2615/1 "2020-02-05T02:56:08Z")

</div>

HI  
I have a bunch of Sigfox devices sending 6 hourly heartbeat messages to my losant backend. I want to be notified (email using sendgrid) if i miss two or more of these messages, ie if the device has gone offline.  
I am pulling the data via a webhook and using various tests on the data field to pull the heartbeat messages out from the real notifications.

What is the best way of going about this?

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [February 5, 2020, 4:21am UTC](https://forums.losant.com/t/heartbeat-messages-alarm/2615/2 "2020-02-05T04:21:46Z")

</div>

I would recommend using the [Device: Inactive Trigger](https://docs.losant.com/workflows/triggers/on-inactivity/). This trigger will fire whenever any specified device does not report state for a specified amount of time.

The easiest approach is to ensure all of your devices have a common tag key. With Sigfox devices, we typically see every device having a `sigfox_id` tag (or something similar) to map the Losant device to the Sigfox device.

You’d then configure the Device: Inactive trigger for every device that has the tag, regardless of value: `sigfox_id=*`. If your devices report a heartbeat every 6 hours, I would recommend configuring the trigger for ~13 hours (long enough to ensure you’ve missed two messages).

The Device: Inactive trigger is driven by state, so your heartbeat messages would have to ultimately record state to the device. I would recommend adding a `heartbeat` number attribute and record a `1` whenever you get a heartbeat message.

With this configuration, the trigger would fire whenever a device does not record a heartbeat state message for ~13 hours, which means it missed two messages. You’d then connect an [Email Node](https://docs.losant.com/workflows/outputs/email/) or a [SendGrid Node](https://docs.losant.com/workflows/outputs/sendgrid/) to the trigger to send your alert.

Protrip: on the payload that the Device: Inactive trigger creates, the field `{{triggerId}}` is the ID of the device that went inactive. You can use that in conjunction with a [Device: Get Node](https://docs.losant.com/workflows/data/get-device/) to get the full details of the device to send with the email.

---

<div class="post-metadata">

**Author:** ![Josh\_Bell](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/josh_bell/32/2554_2.png) [@Josh\_Bell](https://forums.losant.com/u/Josh_Bell)\
**Post date:** [February 19, 2020, 7:21pm UTC](https://forums.losant.com/t/heartbeat-messages-alarm/2615/8 "2020-02-19T19:21:52Z")

</div>

thanks, this is exactly what I was looking for, i just didn’t think to create an additional workflow.
