Ubidots Community

Trouble with custom particle Webhook and posting GPS context

I am sending a long webhook from Particle and the variables are created on ubidots, but my “position” variable is not registering properly such that lat/long coordinates are sent.

Here is what my particle boron device sends:

{
 "battery":4
 "TempF1":74.1875
 "TempF2":73.849998
 "TempF3":74.974998
 "charge":74
 "Signal":50
 "timestamp":1665007328000
 "position":{
  "value":1
  "context":{
   "lat":25.77427
   "lng":-80.19366
   }
  }
 }

Here is the Webhook format:

{
  "battery": {
    "value": "{{battery}}",
    "timestamp": "{{timestamp}}"
  },
  "TempF1": {
    "value": "{{TempF1}}",
    "timestamp": "{{timestamp}}"
  },
  "TempF2": {
    "value": "{{TempF2}}",
    "timestamp": "{{timestamp}}"
  },
  "TempF3": {
    "value": "{{TempF3}}",
    "timestamp": "{{timestamp}}"
  },
  "charge": {
    "value": "{{charge}}",
    "timestamp": "{{timestamp}}"
  },
  "Signal": {
    "value": "{{Signal}}",
    "timestamp": "{{timestamp}}"
  },
  "position": {
      "value": 1,
      "context": {
          "lat": "{{lat}}",
          "lng": "{{lng}}"
      }
  }
}

The value of my position variable on Ubidots is correct (i.e., 1), but my context comes through as:

{"lat":"","lng":""}

I think my Webhook format must need to be changed, but I’m not sure how exactly.

Any suggestions?

Thanks in advance for any help.
-AJ

I was able to figure out the issue:
I needed to send lat/lng as variables in the initial post from the boron device (i.e., it was NOT a problem with the webhook format). Here is what the format looks like now that it has been corrected:

{
 "battery":4
 "TempF1":74.1875
 "TempF2":73.849998
 "TempF3":74.974998
 "charge":74
 "Signal":50
 "timestamp":1665007328000
 "lat":25.77427
 "lng":-80.19366
 "position":{
  "value":1
  "context":{
   "lat":25.77427
   "lng":-80.19366
   }
  }
 }

In summary, I learned that I can (and sometimes must) send data for the webhook without explicitly declaring it as a variable for Ubidots to register (e.g., lat, lng, timestamp).

Hope this helps someone else in the future!

Cheers,

AJ

Hello @csuwaterqualitygroup

Thanks for reaching out and for the update, it is a valuable contribution to our IoT community.

Regards,

-Santiago