Part 2 of 3: Previously, we showed you How to connect your RPi to dweetPro . Now we want to send a message to our RPi, to command our device to do something, like spin a plant for optimal sun exposure. Here is a video of the spinner in action, after receiving the command from dweetPro:To accomplish this, we modify our RPi code to listen for an event trigger. If we see our event is requested, we take action, then reset our trigger.Above, you can see the altered code. First we look at the time, then print the last time the device was spun. Next, we look to see if our event has been triggered.Every 5 seconds we get the latest dweet from dweetPro, and as soon as we see the event has been triggered (1), we spin our device for 3 seconds and Print "toggling spin" to the console.After the toggle is triggered, we then reset the trigger back to 0. It's a pretty simple solution for dweetPro, similar to the dweet.io listen API.The reason we want to use dweetPro over dweet.io is also simple - security!Unfortunately, security itself is not so simple. Before our code above, we must declare all the variables we will need in our requests, including our Thing-Name, our Key, and our header( which requires a long token). All of our parameters are declared at the top:Just replace the example keys with your own, found in the dweetPro management UI. The full example code can be found in this GitHub project.Finally, to activate our spinner, we use the dweetPro console to POST a dweet to our thing, with the content containing the trigger:That's it! By posting that trigger, we send the command to our RPi to spin. As soon as the RPi checks the latest dweet, it will see the event trigger, spin, then reset the trigger back to 0.We now have bi-directional messaging!Next, we will discuss activating that trigger from freeboard with a fancy button, plus new ways to connect, including SMS, Alexa, Slack, and more. Stay Tuned!-Bug Labs, Inc.