Webhooks, the console and Ubidots

Hi Particles,
Got a problem with webhooks and not sure where to start with sorting it. I created a sensor monitoring application, whereby my photon looks for incoming serial data (from an arduino) and publishes it using the particle.publish command using an event called “WAKEUP”, which POSTs the data to Ubidots. I’ve used variations of this code, based on the great example by @aguspg many times and it’s always proven reliable.
I did not use this code for about two weeks and now, for some reason, I don’t seem to be able to initiate the webhook using the defined event. The event publishes fine – I see it and the associated values displayed reliably in the particle console. I do not, however, see any sort of hook /response on the particle console. Regardless of successful communication with Ubidots, shouldn’t there be some sort of error or fail message if the webhook is not initiated?
Greatly appreciate any guidance on this.

1 Like

You can monitor all events using particle subscribe mine. Are you sure the webhook still exists? Check with particle webhook list.

1 Like

Yep, the webhook exists - it’s listed in the console integrations tab - and I checked using the cli. looks to be OK. Same with subscribe mine - I see the data

1 Like

Also checked my ubidots account and have plenty of dots available

1 Like

But your not seeing the webhook response?


1 Like

What if you create another webhook that listens for a different event name?

OK, getting weird - just tried to delete the webhook - and recreate it. But the cli says webhook doesn’t exist
CLI as follows:
“Failed to delete, server said Webhook not found
Potentially unhandled rejection [1] {“ok”:false,“error”:“Webhook not found”} (WARNING: non-Error used)”

1 Like

Weird. Try logging out of particle-cli and logging back in.

Weirder still - just checked the console integrations page and the hook is no longer there… So I either did delete it - or it wasnt there despite both CLI and Integrations page showing it earlier.

1 Like

Strange… Are you able to add a new webhook that listens for a different particle.publish event?

really strange now - I can’t seem to create a webhook using a json file in the same directory as the CLI CMD window. I’ve done this at least a hundred times before using a dummy test file that I’m again using here. Keeps asking for an Event Name

Weird. Maybe @jeiden or @jgoggins can help.

OK - managed to re-create the hook using the console integrations manager - and getting responses now - but a ton of parse errors and “sleeping too many errors” messages".

OK - tried reducing the serial speed to 9600, and adding half second delays at every sample instance - but no difference in the number of parse errors and “Sleeping, too many errors, please wait and try again” instances. The program broadcasts every 20 seconds - so I just don’t get it.

Can you try wrapping your number literal in double quotes to get rid of your parsing errors?

1 Like

Hi @ScruffR, thanks for your response - but I’m a newbie programmer and a little confused by your advice. My broadcast format is pretty much the same as @aguspg 's example. In my case it looks like this:

Particle.publish(“WAKEUP”, “{“NODE 2”:” + String(InConvert2) + “, “NODE 3”:”+ String(InConvert3D) + “, “NODE 4”:”+ String(InConvert4) + “}”);

where InConvert2, 3D and 4 are integers.

I think the number literals are already wrapped - but if not, how do I do it?

The numbers should be wrapped in the output string, not only in code :wink:

Try this (I’d also use PRIVATE events, avoid blanks in the JSON keys - just personal)

Particle.publish("WAKEUP", "{\"NODE_2\":\"" + String(InConvert2) + "\", \"NODE_3\":\""+ String(InConvert3D) + "\", \"NODE_4\":\""+ String(InConvert4) + "\"}", PRIVATE);

// or even better

Particle.publish("WAKEUP", String::format("{\"NODE_2\":\"%d\", \"NODE_3\":\"%d\", \"NODE_4\":\"%d\"}", InConvert2, InConvert3D, Inconvert4), PRIVATE);

// or best to avoid using String
char msg[64];
snprintf(msg, sizeof(msg), "{\"NODE_2\":\"%d\", \"NODE_3\":\"%d\", \"NODE_4\":\"%d\"}", InConvert2, InConvert3D, Inconvert4);
Particle.publish("WAKEUP", msg, PRIVATE);
1 Like

Thanks again, @ScruffR - I’ve tried your char msg solution but the result is much the same. Still getting parse, “Sleeping, too many errors, please wait and try again” and undefined errors, pretty much after every publish event, I will try the original Ubidots code to ensure it’s nothing at their end - but I can only conclude it’s something to do with my code - and I’m guessing in the way I handle incoming (to the Photon) serial(from the arduino -(which is actually an RF capable [Moteino][1] - and operates at 3.3v), The volume and speed of data is really low - so unclear on where I’m going wrong. I’ll try the other options you offered and the standard ubidots code provided by @aguspg and see how it goes. Updates soonest…
[1]: https://lowpowerlab.com/moteino/

Hi @DRCO! could only grab my Electron until now, here my tests.

The post you mentioned is an oldie, which was written before the new Integrations tab existed in the console. With the new Particle Webhooks there’s an option to turn off the default JSON sent from Particle, so we can directly hit Ubidots’ API, which is great.

1- Created a webhook called “Temperature” pointing to Ubidots API

Url: https://things.ubidots.com/api/v1.6/devices/{{SPARK_CORE_ID}}?token=mytokenxxxx

Body (form option): {“temperature”: {{PARTICLE_EVENT_VALUE}}}

Also erased the JSON data that Particle sends by default:

2- This is the test code

void setup() {


void loop() {
  String temp = String(random(60, 80));
  Particle.publish("Temperature", temp, PRIVATE);
  delay(3000);               // Wait for 3 seconds


3- Got data in the console and 201 responses from Ubidots

4- A datasource with your coreid is created automatically in Ubidots:

you can change its name:

Then look into it to see the data!

Note that the label is the unique identifier of the Device, which serves to identify it in the API. This is why I use the CoreID as the Ubidots API label. Hope this works!