Particle Web Hook to CHORDS

We’re trying to create our first Webhook that’ll send data to a CHORDS system. We found some info at https://earthcubeprojects-chords.github.io/chords-docs/usingchords/#particle-iot-hardwarehttps://earthcubeprojects-chords.github.io/chords-docs/usingchords/#particle-iot-hardware but we’re having an issue.

If we hard-code the values, it sends them, but if we have it use variables, the HTTP Request doesn’t include the values. As an example, here’s what we have right now (minus the potentially sensitive data…

GET /measurements/url_create?atmospheric_pressure=810.8&soil_moisture_content=76&soil_temperature=10.4&atmospheric_humidity=37&battery_voltage=3.7&***atmospheric_temperature=***&api_key=<api_key>&email=&instrument_id=1 HTTP/1.1 User-Agent: ParticleBot/1.1 (https://docs.particle.io/webhooks) host: Connection: keep-alive

As you might be able to guess, all values except for apmospheric_temperature are hard-coded.

We know for sure the instrument is working because in the events, we can see it fire (we have it fire every minute at least for now) and the value shows up. However, the actual value isn’t sent.

Any ideas?

Thanks,

Dennis

How have you tried to pass variables?
JSON is usually your friend when needing to pass variables to a webhook.

What we have now:

{
“instrument_id”: “1”,
“email”: “”,
“api_key”: “<api_key”,
“atmospheric_temperature”: “{{atmospheric_temperature}}”,
“battery_voltage”: “3.7”,
“atmospheric_humidity”: “{{atmospheric_humidity}}”,
“soil_temperature”: “10.4”,
“soil_moisture_content”: “67”,
“atmospheric_pressure”: “{{atmospheric_pressure}}”
}

I did just spot in the FAQ’s that in some cases, it uses 3 instead of 2 curly brackets but I can’t find why.

I also noticed something different in the events list. Here’s what it shows with fields separated by /:

Name / Data
atmospheric_temperature / 24.2
Atmospheric Pressure / “atmospheric_pressure”:811.4
Atmospheric Humidity / “atmospheric_humidity”:{45.7}

The last 2 of these are hard coded values.

I meant how do you produce that JSON in code?
In other words: What do you send to the Webhook with what code?

This is a common handlebars convention

Handlebars HTML-escapes values returned by a {{expression}} . If you don't want Handlebars to escape a value, use the "triple-stash", {{{ .