Help creating a webhook needed!

I am trying to make a webhook to effectively visit my selected URL. My url is something like :
https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=KCASANFR5&PASSWORD=XXXXXX&dateutc=2000-01-01+10%3A32%3A35&winddir=230&windspeedmph=12&windgustmph=12&tempf=70&rainin=0&baromin=29.1&dewptf=68.2&humidity=90&weather=&clouds=&softwaretype=vws%20versionxx&action=updateraw&realtime=1&rtfreq=2.5
I would like my webhook to create visit a URL that looks like this
https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=KCASANFR5&PASSWORD=XXXXXX&dateutc={variable}&winddir={variable}&windspeedmph={variable}… And so on with around 15 things formatted as “&someparameter=” followed by a variable from my photon. I want this URL to be “visited” like it was typed into the box at the top of a web browser. PLEASE HELP! I am very new to webhooks and I need help

1 Like

If you just need to “ping” a URL, create a webhook that performs a GET request to the complete URL you posted.

The problem I have is that I need ability for the variables to change. I think that requires a query but I don’t know how to set one up like this.

If you use {{SPARK_EVENT_VALUE}} in your URL, the webhook will replace it with the data string sent in the Particle Publish calling the webhook.

I apologize but I am not quite sure what you mean by that

I mean doing something like:

https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=KCASANFR5&PASSWORD=XXXXXX&{{SPARK_EVENT_VALUE}}

As your URL.

You would make your device generate the string of additional arguments that would need to change and publish them with the webhook call.

Note, the data string in a publish is limited to 64 characters.

Can I do multiple variables with multiple different strings of text leading up to each using this method?

Yes, you can concatenate strings together to produce the final string to send.

Can I use a query in my Webhook and then use an array with each of my text strings that precede the variables assigned to a different variable in my array?

Yes you can.

Just make sure you are sending one final concatenated string in the publish and that it is 64 characters or less.

Nope, it's limited to 255 characters.
https://docs.particle.io/reference/firmware/photon/#particle-publish-

Sorry for the misinformation, I answered this question hastily without checking the docs.

1 Like

I think he’s asking a slightly different question - but I could be wrong. I think he’s asking whether he can publish a string with multiple values or multiple strings, and have the webhook somehow parse those values and place them into the correct spots in the final string. Something like this perhaps:

https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?wind_speed={{SPARK_EVENT_VALUE1}}&wind_dir={{SPARK_EVENT_VALUE2}}

So this may not be what bmwagner is asking, but I’d like to know anyway. This would be perfect for me, but I’m pretty sure it’s not possible - right?

This might be what you want to read
https://docs.particle.io/reference/webhooks/#custom-variables

1 Like

Yes, what ScruffR said. You can put the custom mustache variables in the URL, query fields, and body of the webhook. This is my tutorial on the topic.

1 Like

Thank you both so much. I think that’s exactly what I need. I haven’t yet looked at the tutorial (will in just a moment). But I assume this can be done in forming an HTTP GET request - yes?

Yes, it works for GET in the URL or query parameters. Of course it also works for POST in the body as well.

Yup - I’m just going through your tutorial. Thanks again!