Flexible webhooks for dynamic json data? [Solved]

SOLVED!

Basically I needed to ditch the json Request Format and use the Custom Body format instead.
This, coupled with some trial and error, allowed me to send the publishString without Particle escaping my quotations.

For anyone’s interest this is how the webhook now looks:

{
    "event": "pushdata",
    "responseTopic": "{{PARTICLE_DEVICE_ID}}/hook-response/{{PARTICLE_EVENT_NAME}}",
    "url": "https://[REDACTED].firebaseio.com/devices/{{PARTICLE_DEVICE_ID}}/pushdata.json",
    "requestType": "POST",
    "noDefaults": true,
    "rejectUnauthorized": false,
    "headers": {
        "Content-Type": "application/json"
    },
    "query": {
        "auth": "[REDACTED]"
    },
    "body": "{\"params\":{{{PARTICLE_EVENT_VALUE}}},\"ts\":\"{{{PARTICLE_PUBLISHED_AT}}}\"}"
}

Sending a publishString of the following:

{  
   "params":{  
      "190":599.88,
      "100":280.00,
      "158":3212.75,
      "92":11.00,
      "171":1735.00
   },
   "sig":3
}

Resulted in Firebase parsing it to:
image

Maybe this will help someone else in the future :slight_smile:

3 Likes