# Tips for webhook debugging?

**URL:** <https://community.particle.io/t/tips-for-webhook-debugging/12880>\
**Category:** Cloud\
**Created:** [June 30, 2015, 1:43am UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880 "2015-06-30T01:43:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![seibert](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/seibert/32/5828_2.png) [@seibert](https://community.particle.io/u/seibert)\
**Post date:** [June 30, 2015, 1:43am UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/1 "2015-06-30T01:43:09Z")

</div>

I’m currently trying to get my Photon to log data to an InfluxDB (version 0.9) instance. To log a value to the server, I need to POST to a particular URL with a body like “temp,loc=inside value=79.880005”. It isn’t working, and I’m having a hard time debugging the problem.

It is not obvious from the webhook documentation how to POST data that isn’t JSON or form-encoded. Is this possible? Is there a way for me to dump the HTTP request that the Particle Cloud makes to the server when the webhook fires? Any tips for debugging a webhook that isn’t making the request you expect?

Thanks!

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [June 30, 2015, 3:05am UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/2 "2015-06-30T03:05:52Z")

</div>

If it's not JSON or FORM encoded... then it's likely a QUERY. Check out this example:

> [@\[Webhooks\] Super Simple Motion Activated Push Notifications](https://community.particle.io/t/webhooks-super-simple-motion-activated-push-notifications/10322):
>
> You are about to witness the power of the Particle Cloud like you've never seen before! Say you want to use a Motion Sensor to send yourself a Push Notification every time someone enters your office. Would you believe me if I told you all you needed was 4 lines of code? No really! I wouldn't lie to you angelwebooks-push.ino void setup() { pinMode(D0, INPUT); } void loop() { if (digitalRead(D0) == HIGH) { Particle.publish("office-motion", "OFFICE", 60, PRIVATE); w…

> ...dump the HTTP request that the Particle Cloud makes?

Not currently

Monitor responses:  
[http://docs.particle.io/photon/webhooks/#handling-web-responses](http://docs.particle.io/photon/webhooks/#handling-web-responses)

10 consecutive errors will disable your webhook:  
[http://docs.particle.io/photon/webhooks/#errors](http://docs.particle.io/photon/webhooks/#errors)

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [June 30, 2015, 3:14pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/3 "2015-06-30T15:14:35Z")

</div>

Hi @seibert,

Good question! If you watch your event feed, you’ll see exactly what comes back from your webhook, try

```auto
particle subscribe mine

```

using the CLI. You can also see what the hook is sending by using a site like [http://requestb.in/](http://requestb.in/) It’ll let you generate a url that you can give to your webhook, and then requestb.in will show you exactly what was sent.

I hope that helps! 🙂

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [September 28, 2015, 5:48am UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/4 "2015-09-28T05:48:59Z")

</div>

I have spent hours on this with limited success. requestb.in gives good information and I can verify my server side, but I cannot see enough to know why the request fails from CLI ‘particle publish eventformyapi data’ even though ‘particle publish eventforrequestb data’ seems to work.  
I wonder if this is a CORS, SSL, or Remote Database Access Hosts issue with my database. Perhaps if I had the i/p address of the server that forwards the webhook I could add it to my database and it would not fail. Is there any way to see the response sent to your server from mine. This is too hard to troubleshoot blind and ‘particle subscribe mine’ does not help.  
Any thoughts are appreciated.

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 12:43pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/5 "2015-10-01T12:43:28Z")

</div>

I will attach three screen shots (postman, requestb.in and dashboard). Postman, requestb.in, and my own rest server testing indicate that all is correct. Sorry in advance if I don not thread these together correctly. Notice in them that the requestb.in sure seems to shows that the HTTP POST request from the webhook server is sending the proper content headers and well formated json in the body. However, there is something that my server does not like about it as it responds with an error. One of the things that is confusing to me is the difference between what requestb.in says was sent and what dashboard says was sent.  
{“event”:“coughIn”,“data”:“test3sb”,“published\_at”:“2015-10-01T04:32:21.975Z”,“coreid”:“001\_5xxxxxxxxc\_20xxxxx”,“name”:“name”}  
versus  
{“data”:“test3sb”,“ttl”:“60”,“published\_at”:“2015-10-01T04:32:21.975Z”,“coreid”:“001”,“name”:“coughIn”}  
Which is the truth?  
Anyway, here is the situation  
particle to requestb works  
postman to my database works  
particle to my database does not.  
This would be an easy fix if I was allowed to see what my server said to the webhook server when it passed information (headers and body) in the POST.  
It is doing something that I can’t see and that requestb doesn’t reveal.  
Please let me know how I can view the XHR traffic when the webhook server makes the call so I can see the failure response detail. Otherwise, I cannot make this work (I tried an hour of guess and check to no avail).  
Sam

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 1:13pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/6 "2015-10-01T13:13:33Z")

</div>

> [@sjaybach](#):
>
> requestb.in

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 1:14pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/7 "2015-10-01T13:14:18Z")

</div>

> [@sjaybach](#):
>
> Postman

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 1:15pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/8 "2015-10-01T13:15:40Z")

</div>

> [@sjaybach](#):
>
> dashboard)

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 1:19pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/9 "2015-10-01T13:19:20Z")

</div>

> [@sjaybach](#):
>
> webhook

Also, here is the code I used to create the webhook through the particle command line interface:  
{  
"eventName": "coughIn",  
"url": "[https://myserver.com/REST/resourceabc](https://myserver.com/REST/resourceabc)",  
"json":{"name":"name"},  
"headers": {"Authorization": "MyServer 6be29834h57ikft4b6ffa29c2:1"},  
"requestType": "POST",  
"mydevices": true  
}

---

<div class="post-metadata">

**Author:** ![bryce](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bryce/32/5062_2.png) [@bryce](https://community.particle.io/u/bryce)\
**Post date:** [October 1, 2015, 9:59pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/10 "2015-10-01T21:59:26Z")

</div>

The `hook-response/cough/0` data is the response body. So in this case `ok`. What are you expecting here?

Requestb.in is the truth for what is sent because you received the actual request from our webhook server. If the published event doesn’t match that, that is a bug in our software.

Is there any difference between how you created the webhooks, or how you are triggering them?

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 10:22pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/11 "2015-10-01T22:22:10Z")

</div>

1. I am triggering them from CLI with `particle publish coughIn "garbage string for data"`
2. I created them from CLI with `particle webhook create coughIn`

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 10:35pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/12 "2015-10-01T22:35:24Z")

</div>

The example I showed of the dashboard `hook-response/cough/0` in the screen shot above was the response when the URL in my webhook create JSON was [http://requestb.in](http://requestb.in). I do not mean to confuse the issue here; this is not working for my URL. I was trying to show the successful path between my webhook–it’s triggering–and requestb.in as opposed to the lack of success when I change the URL from [http://requestb.in/sdfjsldhlsh](http://requestb.in/sdfjsldhlsh) to [https://rpt.clarity.com/sdfjsldfj/sdflkjsldjf](https://rpt.clarity.com/sdfjsldfj/sdflkjsldjf). Even though I can prove that the header (content-type and authorization) and body (json) are correct by virtue of success results when I test my URL using Postman and my own REST test lab.  
This is why I believe that the way the webhook server configures the header or body is subtly different than I expect – requestb.in is able to handle the difference but my server cannot. As soon as I know what my server says it does not like, then I will be able to adjust for it.  
Sam

---

<div class="post-metadata">

**Author:** ![bryce](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bryce/32/5062_2.png) [@bryce](https://community.particle.io/u/bryce)\
**Post date:** [October 1, 2015, 10:48pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/13 "2015-10-01T22:48:07Z")

</div>

So you don’t get a `hook-response` event at all?

---

<div class="post-metadata">

**Author:** ![bryce](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bryce/32/5062_2.png) [@bryce](https://community.particle.io/u/bryce)\
**Post date:** [October 1, 2015, 10:49pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/14 "2015-10-01T22:49:24Z")

</div>

Also, is `rpt.clarity.com` the real hostname? The DNS for it does not resolve.

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 10:55pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/15 "2015-10-01T22:55:03Z")

</div>

Yeah! You fixed it. Thank you, thank you, thank you. Now I am getting data from a CLI publish event into my database. Next I will do this from a photon, then take it outside with an electron. I see that the format of dashboard has changed. Perhaps you made a modification or it is fixed with the upgrade, but it is working now! excellent.  
Sam

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 10:56pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/16 "2015-10-01T22:56:10Z")

</div>

was getting generic error without any detail. But now it is working.

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 10:56pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/17 "2015-10-01T22:56:49Z")

</div>

no that is not the real host name. But now it is working with today reboot or upgrade.

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 1, 2015, 11:09pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/18 "2015-10-01T23:09:11Z")

</div>

Photon is dutifully logging data to my database every 15 seconds 😛

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [October 5, 2015, 5:23pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/19 "2015-10-05T17:23:51Z")

</div>

awesome! Glad you guys got this working! (Sorry I missed this, was out on vacation last week 🙂 )

Thanks,  
David

---

<div class="post-metadata">

**Author:** ![sjaybach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sjaybach/32/7119_2.png) [@sjaybach](https://community.particle.io/u/sjaybach)\
**Post date:** [October 7, 2015, 8:29pm UTC](https://community.particle.io/t/tips-for-webhook-debugging/12880/20 "2015-10-07T20:29:09Z")

</div>

Now it has stopped working. It was working this morning. But now it is not. Dashboard does not give the response from my server. So we are back to where we were a week ago. 6 days ago Bryce (I thought) did something on your end that allowed the webhook to work. Perhaps this was a reboot of the webhook server? Perhaps it was nothing but chance. Now I was trying to get the electron to do the same. Both give a webhook error. But there is no data in the error response. I know that my server sends something if it is contacted with an invalid POST. I think this is on your end. Please help. And Thanks. Sam

[Next page](https://community.particle.io/t/tips-for-webhook-debugging/12880.md?page=2)
