Webhook with custom JSON


I have a custom webhook met custom JSON:

  "device": {
    "deviceId": "{{{PARTICLE_DEVICE_ID}}}"
  "measurements": {

What I really don’t understand that how I can use this in my publish method:

void loop() {
  // Get some data
  String data = String(10);
  // Trigger the integration
  Particle.publish("iot-device-bridge", data, PRIVATE);
  // Wait 60 seconds

I have searched the forum and internet, but cannot find a good example howto create the code for that webhook.

I am not convinced you have read all the tutorials and topics on the Particle Forum. You wouldn’t have the event name in the JSON structure like that. Try a search on “mustache”.

A simple test sketch/might look something like this to publish an event called PARTICLE_EVENT_NAME with a value label called PARTICLE_EVENT_VALUE and an integer variable someValue.

const char* const eventName = "PARTICLE_EVENT_NAME";
const char* const eventValue = "PARTICLE_EVENT_VALUE";
const char* const deviceID = "PARTICLE_DEVICE_ID";     //better to get with System.deviceID()
unsigned long lastsend;
int someValue;
char dataStr[600];
void setup()
    lastsend = 0;
    someValue = 0;
void loop()
    if (millis() - lastsend >= 60000)
        lastsend = millis();
        snprintf(dataStr, sizeof(dataStr), "{\"device\":{\"deviceID\":\"{{{%s}}}\"},\"measurements\":{\"{{{%s}}}\":\"{{{%i}}}\"}}", PARTICLE_DEVICE_ID, eventValue, someValue);

Hi Armor. Thanks for your reply. I am really new on the particle stuff, so sorry that I didn’t searched well.

Thanks again for your answer!

I see where you got that example from now - use of String object is not good practice!