Webhooks for influxdb > 0.9.1


I cant figure out how to create a webhook that can deal with new influxdb line format (ie no more JSON)

Has anybody managed to create one that works?


Hi @tylerdurden!

I have the same problem. Did you manage to get it working?
I am using node-red to receive the published data and send it to my influxdb. It works but it is saved as one string.

My Code:

Particle.publish("Test", String::format("Name=testname t=%.2f %d", temp, time));


time value
2016-01-21T01:01:25.884Z "Name=Testname t=23.40 1453338078"

As I am a big database noob it is difficult for me to find the correct solution.
[influxdb documentation][1]
I appreciate any kind of help :slight_smile:

If everything works I would like to provide a tutorial for how to set everything up.
[1]: https://docs.influxdata.com/influxdb/v0.9/

Hi @hl68fx!

I didnt find a satisfying answer to this issue and instead used the UDP port of the Influxdb to send the metrics from the photon.


I think I found the problem but I did not have any luck to find a solution.

The node red plugin says:
The fields and tags to write are in msg.payload. If the message is a string, number, or boolean, it will be written as a single value to the specified measurement (called value).

So it detects my Particle.publish as a String because everything is sent to "value".

The node red plugin also says:
If msg.payload is an object containing multiple properties, the fields will be written to the measurement.

But how can I send an object via Particle.publish or how can I convert it with the help of a function node?

For what it’s worth, I was able to get it to work using the deprecated JSON API, here’s a working webhook:

  "event": "spark/status",
  "url": "https://580ca189.ngrok.io/write",
  "requestType": "POST",
  "noDefaults": true,
  "json": {
    "database" : "calibration",
    "points": [
      { "measurement": "test2",
        "tags": { "sensor": "{{SPARK_CORE_ID}}" },
        "fields": { "value": "{{SPARK_EVENT_VALUE}}" }
  "mydevices": true

Sadly, this won’t work for long, the JSON API is supposed to be removed by version 1.0. @Dave, do you think the webhooks could be enhanced to give us more control over exactly what data to send? Something like this, for example:

"requestType": "POST",
"noDefaults": true,
"raw_form": {
  "test2,sensor={{SPARK_CORE_ID}} value={{SPARK_EVENT_VALUE}}"

This should result in a POST request with just the raw_form data, no key/value pairs and no interpretation of HTML characters. What do you think?

1 Like

Hi @Alex_,

Totally! This is a very popular requested feature, and something that’s on my roadmap for webhooks. I’ll reply here when it’s released. :slight_smile:



That are awesome news! I have it working through node red but it is not reliable at the moment. That’s the reason why I did not share it until now. I can only assume that there is a problem with my node red installation.
Using webhooks would remove my current error source :smile:

Influxdb recently released Version 0.10

I am using if I remember it right and it is an awesome and easy to use database!

1 Like

Hi @Dave,

are you planning to use Telegraf in combination with a Plugin to send data from a Webhook to Influxdb? Or will the Webhook send the data in a direct way to the database?

1 Like

Hi @hl68fx,

I had been planning on inserting rows directly into a database, but Telegraf looks like a nice service as well, sounds like you could use a vanilla hook with something like that as well.