Looping into your questions:
1. Where in your Webhook does it specify the Device ID for the device I am sending the data to?
A: The Webhook is not specifying the Device ID; the data is received in the Particle Cloud through the Particle Token (the one assigned in the body of the webhook), which the master key of your Particle Account. The Ubidots Webhook is pointing to the Particle Cloud, and the data incoming is centralized the Particle Cloud, at this point you should be able to see the data received (see below) in the console of the particle cloud.
Once the data is properly received, you should upload the respectively firmware to the device desired to obtain the data from Ubidots. For example, as you can see in the image above the Event Name is UbidotsWebhook (the one assigned in the body of the Ubidots Webhook), now you need to establish the subscription to the event configured, in this case will be the one called “UbidotsWebhook”:
void setup() {
Serial.begin(115200);
// Subscribe to the integration response event
Particle.subscribe("UbidotsWebhook", myHandler);
}
int i = 0;
void myHandler(const char *event, const char *data) {
// Handle the integration response
i++;
Serial.println(i);
Serial.print(event);
Serial.print(", data: ");
if (data)
Serial.println(data);
else
Serial.println("NULL");
}
void loop() {
}
2. the data={{last_value}} , how does that tie to a specific variable’s name? So I made a variable with the name “messaging” that I am toggling on a dashboard but, how does this webhook tie to that?
A: The {{last_value}}
key returns the last value of the variable established as condition in your event. Following the example mentioned above, I created two events in order to handle the data once a variable change it’s status, the variable is called “control” and this is going to be a switch widget at Ubidots; this variable is going to provide me just two values, 1 and 0.
Once one of the events (one - if control value is less or equal to 0. two - if control value is equal to 1) is triggered the last value obtained is the one sent to the Particle Cloud.
3. The structure of this webhook is different than the one you posted earlier in this thread. Is it still possible to send a specific value to a specific function from a specific device as it was back then?
A: Yes, if you desire you can send an specific value, but take in count that the value should not have any quotes. Following the structure of your webhook you should have something like below:
Body: access_token={Particle_Token}&arg=1
At this point I highly recommend you check if the body of the webhook doesn’t have any space or special character included.
4.Since I have the structure that works as a curl command, can’t I put that same content into your form?
A: You are able to put the same content in the Ubidots Webhook, you should not have any issue with it. As I noted in the image provided by you at first, you are assigning the parameters args
between quotes, probably this is causing you issue.
I hope this clarify all your doubts!
Btw, the article is already updated!
All the best,
Maria C.