Webhooks trouble

Having a hard time getting this to work. I have a json that is generated on the board and I just need the webhook to pass this on. Its not working right. I have tried a few different options and I am not getting back the answer that I want. This works on cli with curl

Here is the json inside the particle publish

{\"id\": \"111111aaaaaaa\",\"report_at\": \"2020-12-08 09:15:00\",\"lat\": 36.866666656,\"lon\": -96.9032,\"elev\": 1880,\"mph\": 0,\"dir\": 180,\"active\": 1,\"gps\": 1}

Here is the the curl command

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --data-binary "{
    \"id\": \"111111dssssssss\",
    \"report_at\": \"2020-12-08 09:15:00\",
    \"lat\": 36.866666656,
    \"lon\": -96.9032,
    \"elev\": 1880,
    \"mph\": 0,
    \"dir\": 180,
    \"active\": 1,
    \"gps\": 1
}" \
'https://www.spotternetwork.org/positions/update'

ID code and gps had been changed.

thanks for the help.

Have you tried directing that webhook at a alternative server where you can observer the raw request (e.g. requestbin.com)?

Does your sample data turn up complete in this format in console.particle.io/events?

What does “Its not working right” mean exactly?
If you are “not getting back the answer I want” what are you getting back?
What does the webhook log tell you?

I will try the different server tonight when I get back to the device.

Yes what is coming out of the device is correct my fully correct json.

The response from the website is ether an empty 200 return or a full redirect to their website. The correct response is a json that has everything submitted to it along with success at the end.
As far as the webhook log I am a little disappointed in that it is not showing what is going to the website but only the header.

I feel like there is just an option maybe missing from the webhook. I have made other ones to send stuff and had no real issues.

I was able to do some testing going to requestbin and from particle it is sending the \" and coming from curl that is striped and looks good.

When I send your data to requestbin.com I get this


which seems OK to me.

Can you show your webhook definition?
This is how mine looks

I just have the {{{PARTICLE_EVENT_VALUE}}} for the json value.

I think my problem was me trying to do some testing by waiting on parts in the mail. My gps showed up today and I went ahead and finish writing the code and put everything through the json generator instead of just making a completely static string(char array) and now its going through the webhook properly.

Thanks for the help. I do not post much on here but do find a lot good information from these boards.

2 Likes