Particle Cloud Webhook doesn't work correctly when trying to send string as argument

Hi everyone,
I kind of ran out of idea for what I should do to fix this.
This is my data from my code

  String msg = String::format("{ \"wl1\": %0.5f, \"wl2\": %0.5f, \"wl3\": %0.2f, \"temp\": %0.2f, \"b\": %0.2f, \"at\": %s }", 
                              111.00230, 111.44421, 111.33, 30.11, 40.22,"2020-01-23T05:46:16Z");

Event in the Webhook

{
  "name": "Boron-1",
  "data": "{ \"wl1\": 111.00230, \"wl2\": 111.44421, \"wl3\": 111.33, \"temp\": 30.11, \"b\": 40.22, \"at\": 2020-01-23T05:46:16Z }",
  "ttl": 60,
  "published_at": "2020-01-23T06:22:19.218Z",
  "coreid": "XXXXXXXXX"
}

*This is my JSON

{
    "event": "Boron-1",
    "url": "*******",
    "requestType": "GET",
    "noDefaults": true,
    "rejectUnauthorized": false,
    "query": {
        "email": "xxxxxxx",
        "api_key": "xxxxxxx",
        "WL1": "{{{wl1}}}",
        "WL2": "{{{wl2}}}",
        "WL3": "{{{wl3}}}",
        "B": "{{{b}}}",
        "at": "{{{at}}}"
    }
}

This is what I got on the Request

GET /measurements/url_create?instrument_id=20&at=&B=&WL3=&WL2=&WL1=&api_key=xxxxx&email=xxxxx HTTP/1.1
User-Agent: ParticleBot/1.1 (https://docs.particle.io/webhooks)
host: xxxxxxx
Connection: keep-alive

Before I added β€œat” = β€œ{{{at}}}”, it was working fine. The Request was this.

GET /measurements/url_create?instrument_id=20&B=40.22&WL3=111.33&WL2=111.44421&WL1=111.0023&api_key=XXXX&email=XXXXXX HTTP/1.1
User-Agent: ParticleBot/1.1 (https://docs.particle.io/webhooks)
host: XXXXXX
Connection: keep-alive

Please help I have no idea what I’m doing wrong.

Thanks in advance,
Phisuthisak

You need to wrap your at value in double quotes otherwise the entire JSON will be invalid.

3 Likes

It’s working now. Thanks a lot.