2017-11-17 08:03:19 +08:00
# particle webhooks
2019-03-09 03:25:20 +08:00
You should configure your Particle.io's Webhooks to point at the `webhooks` service. To do this go to [https://console.particle.io ](https://console.particle.io/ ) and click `Integrations > New Integration > Webhook` . In the resulting page set `URL` to `http://<my_ip>:1619/particle` , and under `Advanced Settings` click on `JSON` and add:
2017-11-17 08:03:19 +08:00
2020-08-11 03:50:48 +08:00
```json
2017-11-17 08:03:19 +08:00
{
"measurement": "your_measurement_name"
}
```
If required, enter your username and password, etc. and then click `Save`
## Events
Your Particle device should publish an event that contains a JSON in the form of:
2021-11-25 02:50:22 +08:00
```json
2017-11-17 08:03:19 +08:00
String data = String::format("{ \"tags\" : {
2021-11-25 02:50:22 +08:00
\"tag_name\": \"tag_value\",
\"other_tag\": \"other_value\"
2017-11-17 08:03:19 +08:00
},
2021-11-25 02:50:22 +08:00
\"values\": {
\"value_name\": %f,
\"other_value\": %f,
2017-11-17 08:03:19 +08:00
}
}", value_value, other_value
2021-11-25 02:50:22 +08:00
);
2017-11-17 08:03:19 +08:00
Particle.publish("event_name", data, PRIVATE);
```
Escaping the "" is required in the source file.
2020-05-14 15:41:58 +08:00
The number of tag values and field values is not restricted so you can send as many values per webhook call as you'd like.
2017-11-17 08:03:19 +08:00
You will need to enable JSON messages in the Webhooks setup of Particle.io, and make sure to check the "include default data" box as well.
See [webhook doc ](https://docs.particle.io/reference/webhooks/ )