Mismatch in Particle Console and Received Data


We are using Base85 to publish binary data and have noticed that sometimes there is a mismatch between what we publish from our device and what we receive at our endpoints. This occurs in cases where 2 forward brackets are published “{{” in our event data.

Below is a reduction of what we do that can demonstrate what happens.
I publish via: Particle.publish("myData", "{{");
Particle console reports correctly: {{
Our Endpoint reports empty string in the request body.

Note that using a single bracket results in a single bracket received at all points.

We are using django to handle post requests, which we receive thru particle webhooks.

I am not sure what happens when particle triggers our endpoint thru webhook, but it doesn’t appear to send the same data as reported thru the console. It appears as {{ is protected or substituted out in some way.

Is this mentioned somewhere along with a list of chars that cannot be sent? Is there a way to structure our webhook in a way that avoids this substitution?

I could try to do a string replace after I base 85 to replace {{ with something else, but I would prefer not to do this if possible.



I was able to reproduce by publishing event data {{ and using a webhook that uses the default template

  "event": "{{{PARTICLE_EVENT_NAME}}}",
  "data": "{{{PARTICLE_EVENT_VALUE}}}",
  "coreid": "{{{PARTICLE_DEVICE_ID}}}",
  "published_at": "{{{PARTICLE_PUBLISHED_AT}}}"

and does a POST to an external server in JSON. It happened to be requestbin.com, so I could inspect the request.

The problem is that {{ delimits mustache template. I would expect this to be an issue in the template, but not the data, but clearly that’s not the case.

I believe it’s because when the template is rendered, it’s rendered recursively. It’s not really a desirable behavior in this instance, but it’s probably necessary when some other templates are rendered.

Unfortunately there doesn’t appear to be a good way to get around this at this time using webhooks. The only character sequences that should be affected are {{ and {{{, however.

The SSE event stream is not affected, which is why the console displays correctly.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.