Webhook [Object object] issue

Is there any more support on this?
I’m trying to do something similar and am seeing my raw webhook request as
[object Object]

I split your posts out into a separate topic as it does not seem related to the two other posts you commented in.

  • What string you publishing?
  • What is in your webhook? What template specifiers are in it, and in what fields?

Webhook is:

{
“token”: “MYSPECIALTOKEN”,
“variables”: “{{{MY_DYNAMIC_JSON}}}”
}

A String called raw_data_string holding the desired data

{ “var1”: 1.0, “var2”: 2.0, “var3”: 3.0 }

Initially I was attempting to do this with the following:
String json_string = String::format(
“{ “MY_DYNAMIC_JSON”: %s }”, raw_data_string.c_str());

then on the particle side

Particle.publish(“update_webhook”, json_string);

but this gives the object output when debugging the webook

As it turns out, that is not possible. The reason is that you can’t create a mustache template member for a value in a JSON object that is a JSON object.

If your dynamic JSON object is the whole thing sent from the device, then you can do it using:

{
"token": "MYSPECIALTOKEN",
"variables": {{{PARTICLE_EVENT_VALUE}}}
}

Note that there are no double quotes around {{{PARTICLE_EVENT_VALUE}}} and there are three curly brackets. Both are important.

There’s more here, including an interactive template tester:

https://docs.particle.io/tutorials/device-os/json/#mustache-variables

That doesn’t appear to be valid when creating the webhook. Unless I should be looking into it another way.

The webhook debug shows it as the data though!
Just doesnt come through on the webhook output side

image

It’s PARTICLE_EVENT_VALUE

This works!
Thank you, assumed that the x on the box would not allow it to work.

It flags it as an error because that’s not valid JSON before the template is rendered. It still allows you to save it, and once saved, it works, because after the template is rendered, it is valid JSON.

Sorry about the PARTICLE_EVENT_VALUE mistake. Glad it’s working!