# Cloud to device message from custom widget

**URL:** <https://community.cumulocity.com/t/cloud-to-device-message-from-custom-widget/5895>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [April 12, 2023, 5:51am UTC](https://community.cumulocity.com/t/cloud-to-device-message-from-custom-widget/5895 "2023-04-12T05:51:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![d.sharma](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@d.sharma](https://community.cumulocity.com/u/d.sharma)\
**Post date:** [April 12, 2023, 5:51am UTC](https://community.cumulocity.com/t/cloud-to-device-message-from-custom-widget/5895/1 "2023-04-12T05:51:11Z")

</div>

#### _Product/components used and version/fix level are you on:_

#### _Detailed explanation of the problem:_

Hi,  
I have developed a app using Application builder and a custom widget to show alarm list, to fetch this alarm data i want to call rest over mqtt from cloud to device.

my device is capable to listen messages from cloud and return response.

i want to publish message to device using my custom widget same a shell command do.

Any help or code refrence for this implementation?

Thanks,  
Deepak Sharma

#### _Error messages / **full error** message screenshot / log fileL_

#### _Is your question related to the free trial, or to a production (customer) instance?_

#### _Have you installed all the latest fixes for the products and systems you are using?_

---

<div class="post-metadata">

**Author:** ![Vikash\_Sharma1](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/vikash_sharma1/32/4904_2.png) [@Vikash\_Sharma1](https://community.cumulocity.com/u/Vikash_Sharma1)\
**Post date:** [June 28, 2023, 3:56am UTC](https://community.cumulocity.com/t/cloud-to-device-message-from-custom-widget/5895/2 "2023-06-28T03:56:43Z")

</div>

hi @d.sharma,  
Can you please elaborate you have developed on which product and version?

Regards  
Vikash Sharma

---

<div class="post-metadata">

**Author:** ![Bharath\_Meka1](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/bharath_meka1/32/9510_2.png) [@Bharath\_Meka1](https://community.cumulocity.com/u/Bharath_Meka1)\
**Post date:** [June 28, 2023, 4:59am UTC](https://community.cumulocity.com/t/cloud-to-device-message-from-custom-widget/5895/3 "2023-06-28T04:59:10Z")

</div>

I believe he is referring to cumulocity here? labeling is wrong.

---

<div class="post-metadata">

**Author:** ![Tristan\_Bastian](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/tristan_bastian/32/18259_2.png) [@Tristan\_Bastian](https://community.cumulocity.com/u/Tristan_Bastian)\
**Post date:** [June 28, 2023, 6:10am UTC](https://community.cumulocity.com/t/cloud-to-device-message-from-custom-widget/5895/4 "2023-06-28T06:10:43Z")

</div>

Hi Deepak,

The datastructure of the shell command operation is covered here: [Device management library - Cumulocity IoT Guides](https://cumulocity.com/guides/reference/device-management-library/#reference)

You can use the OperationService ([https://resources.cumulocity.com/documentation/websdk/client/classes/operationservice.html#create](https://resources.cumulocity.com/documentation/websdk/client/classes/operationservice.html#create)) to create the operation for the device and afterwards use the real-time API to listen for updates of the operation coming from the device.

You may want to consider creating your alarms directly within Cumulocity instead of requesting them from the device.

Regards,  
Tristan

---

<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 25, 2023, 6:10am UTC](https://community.cumulocity.com/t/cloud-to-device-message-from-custom-widget/5895/5 "2023-12-25T06:10:57Z")

</div>

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