开发者

How do I debug a webhook POST?

A webhook is sending me a POST, and I want to do some debugging on it. Currently I'm looping over the array and then sending a mail() to myself inst开发者_开发问答ead of printing (because how could I see what's printed to the page?), but I'm betting there's a more efficient way.

Any suggestions?


https://requestbin.com/ lets you create a temporary URL that will show you all the HTTP request data sent to it.


There are multiple options for debugging:

  1. Use a debugger with an IDE, like netbeans. This will run the application and figure out where things are going wrong.
  2. Use logfiles of your server, or generated by application exceptions
  3. Collect your debug information with a buffer and put it in a file in your public directory. Overwrite with every new request.


I know this is quite an old question but if you want to see what kind of responses you are going to get from webhooks or you need to need to access the developer environment then there are a selection of tools that can help you.

RequestBin is probably one of the simplest to use by, providing a unique URL that you can then set this as your endpoint for Event notifications. Using this URL you can check to see what responses you are receiving.

You can generate a unique URL by creating a RequestBin.

An Example URL is this:

http://requestb.in/XXXXXXXX

This will be used to receive Event Notification Data and Receive Inbound Parse Data.

The results will then be found by heading to your RequestBin unique URL.

Ngork is also a tool that is useful for creating a local tunnel to your machine. This makes testing webhooks locally easy.

To setup install and enter the following in your CLI (after signing up first):

 $ ngork 3000

This would open a connection to the port 3000 that is on your local machine, then at a URL you can put your URL for your PARSE Webhook or Event Webhook.

 $ ngrok -subdomain=myappname 3000

Runscope is a tool for debugging APIs. It acts as a proxy, collecting all data sent to it and passes it on to another point. You may then, later, review what was sent to the API you’re debugging.

Source : https://sendgrid.com/docs/API_Reference/Webhooks/debug.html


http://httpresponder.com/ works also, and lets you configure a canned response if you need one.


You can use https://www.reliablewebhook.com/. They also have a plugin for Visual Studio Code for local debugging.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜