cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Is it possible to do a message service in thingworx studio?

dsengupta-21
2-Guest

Is it possible to do a message service in thingworx studio?

I want to make an experience where I want to write some message and some other user who is using the same experience will get that message and will be able to reply back.

Is it possible? Any kind of solution is welcome...

Thank you...

Regards,

Dipika

Message was edited by: Sushant Pandey moving this to ThingWorx Studio for correct visibility.

1 ACCEPTED SOLUTION

Accepted Solutions
ankigupta
5-Regular Member
(To:dsengupta-21)

Hi Dipika Sengupta​,

In ThingWorx; Create a Custom Service (which takes String input and append the message to the property current value).

On Studio; we can use a widget to enter the message and one button widget.

Bind the text from the text widget to ThingWorx Service parameter.

Bind the Button click event to the Custom Service created above.

On click of button; ThingWorx Service will be invoked and takes input from the widget takes the input message. the updated data will reflect in ThingWorx platform.

I hope it helps.

View solution in original post

14 REPLIES 14

Well the first "Thing" that comes to mind is implementing some kind of MQTT chat.

With MQTT you can publish and subscribe to certain topics.

Whenever a new message is posted, it will be automatically pushed to all the subscribed clients.

There's nice post from Franck in this thread: MQTT support in ThingWorx

This is of course done on the ThingWorx Platform side.

On the ThingWorx Studio side, you could then e.g. implement a text area and connect it to the MQTT-Thing on the Platform to receive the latest updates.

But that's just one specific example, depending on your actual use case there might be other, more suitable solutions.

ankigupta
5-Regular Member
(To:dsengupta-21)

Hi Dipika Sengupta​,

As per my understanding; you can try following:

On ThingWorx; we can have a Thing with a property and a Custom Service (which takes one input and append the message to the property current value).

On Studio; we can use a widget to enter the message and one to display the text message and one button.

On click of button data; ThingWorx Service will be invoked and takes input from the widget takes the input message.

Link the property from the ThingWorx Thing to the Widget that display the Message.

I hope it helps.

Hi Ankit Gupta

I have created a property called NewTestProperty in the Car1 Thing. And have created a service called Test and in the script I have written "Test=me.NewTestProperty". Then I have linked the button to the service and the thing to a textbox. I am able to send data from the thingworx platform to the studio. But not the vice versa. Can you please suggest me some way to do that?

Thank you...

Regards,

Dipika

ankigupta
5-Regular Member
(To:dsengupta-21)

Hi Dipika Sengupta​,

In ThingWorx; Create a Custom Service (which takes String input and append the message to the property current value).

On Studio; we can use a widget to enter the message and one button widget.

Bind the text from the text widget to ThingWorx Service parameter.

Bind the Button click event to the Custom Service created above.

On click of button; ThingWorx Service will be invoked and takes input from the widget takes the input message. the updated data will reflect in ThingWorx platform.

I hope it helps.

Hi Ankit Gupta

Thanks for your reply. Can you please share the script needed in the Service. The script I am using is not working it seems.I am following this tutorial Set Thingworx Platform property value from Thingworx AR (Vuforia) Experience . But not able to get data in the platform. It'll be helpful if you can graphically show what is to be done.

Regards,

Dipika

ankigupta
5-Regular Member
(To:dsengupta-21)

Hi Dipika Sengupta​,

The script for this scenario could be something like:

me.StringProperty=me.StringProperty+" "+StringInputParameter;

where StringProperty is a String Property in the Thing.

And StringInputParameter is the String Input Parameter of the service.

The link shared has Step by Step details of what I did. Do let me know if you need clarification in any step?

I hope it helps.

Hi Ankit Gupta

Thank you for your help.. It's working!!

I have another doubt. After sending the data to the platform I am binding the Thing with another Textbox. So that whatever is written in the TextArea will be reflected in the Textbox. But every time I login the previous messages stays there as it is linked to the Thing. How can I make it empty on load every time?

I want the message to be shown only when someone enters something in the Textarea. Kindly give some solution to the problem.

Regards,

Dipika

ankigupta
5-Regular Member
(To:dsengupta-21)

Hi Dipika Sengupta​,

There is a Model Loaded event for the 3D Model widget which is generated when the 3D Model is Loaded. You can use this event to call a custom Service which clears up the ThingWorx String Property.

If you are using just 2D Model; this option is not available. So, in this case you can add a Clear Button to call the custom Service which clears up the ThingWorx String Property.

I hope it helps.

ankigupta
5-Regular Member
(To:dsengupta-21)

Hi Dipika Sengupta​,

If this issue is resolved; please mark Helpful and correct answers in this Thread (if any) to close the Thread and let other members know that this Thread has a solution.

BryanK
14-Alexandrite
(To:dsengupta-21)

Hi,

This is a Great idea, I was looking for something like this a while ago, I was thinking about a type of contact me button.

Where the user can enter information into a text box. email address or telephone number and then select a contact me button.

Will be watching this topic closely.

Hi Ankit Gupta

Thanks for your help. Can you please tell me if it is possible to send any thing other than text ( eg: Image, file) from thingworx studio to the platform?

Regards,

Dipika

ankigupta
5-Regular Member
(To:dsengupta-21)

Hi Dipika Sengupta​,

I have not explored this requirement so I am not sure if it's possible. I will check internally and will let you know.

ankigupta
5-Regular Member
(To:dsengupta-21)

Just to add; from ThingWorx point of view I know that ThingWorx can receive images and text file via REST calls. But I am unsure how to link those parameters (Image,text) in STUDIO. I am checking internally for same.

Hi Ankit Gupta​,

Thank you for checking. Please let me know if you find anything.

Regards,

Dipika

Top Tags