# Event to listen when a new device is onboarded

**URL:** <https://community.cumulocity.com/t/event-to-listen-when-a-new-device-is-onboarded/4044>\
**Category:** Forum\
**Tags:** device-connectivity, cumulocity\
**Created:** [June 30, 2023, 5:03am UTC](https://community.cumulocity.com/t/event-to-listen-when-a-new-device-is-onboarded/4044 "2023-06-30T05:03:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rushikesh\_n](https://avatars.discourse-cdn.com/v4/letter/r/c57346/32.png) [@rushikesh\_n](https://community.cumulocity.com/u/rushikesh_n)\
**Post date:** [June 30, 2023, 5:03am UTC](https://community.cumulocity.com/t/event-to-listen-when-a-new-device-is-onboarded/4044/1 "2023-06-30T05:03:57Z")

</div>

I wanted to listen to the event when a new device is onboarded in Cumulocity in EPL ,how can it be done in EPL ?

---

<div class="post-metadata">

**Author:** ![Harald\_Meyer](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/harald_meyer/32/1959_2.png) [@Harald\_Meyer](https://community.cumulocity.com/u/Harald_Meyer)\
**Post date:** [June 30, 2023, 5:59am UTC](https://community.cumulocity.com/t/event-to-listen-when-a-new-device-is-onboarded/4044/2 "2023-06-30T05:59:35Z")

</div>

Yes you can do that. All new and changed managed objects are sent to Streaming Analytics. So you can do something like this:

```auto
monitor.subscribe(ManagedObject.SUBSCRIBE_CHANNEL);
on all ManagedObject() as mo {
  if(mo.isCreate()) {
     // Do something
  }
}

```

Note that this way, you get all managed objects and not all of them are devices. So you have to decide how you want to determine if something is a device. You could do that by type or checking for the c8y\_IsDevice fragment:

```auto
on all ManagedObject(type="DEVICE_TYPE") as mo {
  
}

// or

on all ManagedObject() as mo {
  if(mo.isCreate() and mo.params.hasKey("c8y_IsDevice")) {
     // Do something
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [December 27, 2023, 6:00am UTC](https://community.cumulocity.com/t/event-to-listen-when-a-new-device-is-onboarded/4044/3 "2023-12-27T06:00:25Z")

</div>

Closed on December 27, 2023, 6:00am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
