I just started getting into webhooks on my Photon the other day (very nice feature, I hope you guys will keep improving it) and ran into some walls. I’m not sure if they’re mine, or problems with webhooks, or a combination.
I have a small endpoint (written in C#) that accepts POST requests (it just takes a string and then I do what I want from there). When I’m running in localhost mode in Visual Studio, and I create a webhook to post to that URL,I get a hook-response on my dashboard, but the data field is always empty.
When I upload that same service to my server and point a webhook at it, I get no response at all.
What exactly is my webhook sending if simply have a Spark.publish("Test, "test")?
Also, what does the Photon expect in return?
Thanks for your time.
SOLVED!: It was the dumbest mistake I think I’ve ever made. I forgot to put http:// in front of my domain.
Thanks to @peekay123 for his suggestions and @kennethlimcp for directing me to requestb.in. Seems like a nice resource, I’ll keep it in mind for the future.
@Ellis, webhooks are fired by a Spark.publish() and the Photon receives a response via a Spark.subscribe(). Have you tried the documented example? You may want to post your webhook as well so we can see what may be going on.
I’m using the CLI command: particle webhook create myapi.json.
As I said, when I use this with localhost, I get an empty event on my dashboard.
Sorry for my poor choice of words, I don’t really need to get data back to my Photon as much as I need to see it in my dashboard.
@Ellis, when you say “localhost” I assume you are running the targeted server locally? Or do you mean the local Particle Cloud server? Webhooks run in the Cloud and when fired will send a request to the targeted server. If your localhost server is not published publicly then the webhook will not reach your intended target.
@kennethlimcp That is the URL I want, for sure. That is the destination for my own API. I have several api’s on my site, so I just named this one particle. The URL targets an MVC controller. Sorry for the confusion.
@peekay123 Sorry for being unclear. Yes, that is the server targeted locally. The funny thing is, it did reach my local server, and pushed an event to dashboard.
@peekay123 That’s just it, my local server is working fine. I’ve sent numerous test requests to it using a nice tool called SoapUI, and they all worked. However, when I set up the webhook for the URL, it doesn’t work.
if your server is local and cannot be reached by the internet, Webhooks will not be able to do it as well. It’s like your TV at home should not be controlled by someone on the other end of the globe when it is powered off