WingCash can notify your software about new transfers and updates to existing transfers using a simple but powerful mechanism called a webhook. Add an URL handler to your own web server that receives a JSON formatted HTTP POST from WingCash, then configure your WingCash profile to call your handler’s URL. By default, WingCash calls your handler for every transfer in which you are a stakeholder (participant), but you can instruct WingCash to filter what kind of transfers and states should trigger the webhook. You can create as many webhooks as you need (within reason.)

To configure webhooks in your WingCash profile:

  1. If you haven’t already, sign up for WingCash.
  2. Visit your settings page and enable developer mode by checking the Software Developer checkbox at the bottom of the Profile form. Save the change. If you are doing this for a business, you should first switch to that business and then check the Software Developer checkbox.
  3. With developer mode enabled, your Tools menu now has a Webhooks menu item. Click that menu item.
  4. Add the URL of your webhook handler. If you haven’t written your handler yet or you need to test, create a webhook handler URL using a service like http://requestb.in or https://webhookapp.com.
  5. Trigger the new webhook by sending cash to a friend (or to a business that you manage.) Don’t forget to remove test webhooks when you’re done.

When WingCash calls the webhook, it provides a JSON request body containing these attributes:

  • source_url: The WingCash URL for managing this webhook.
  • webhook_url: The handler URL.
  • transfers: A list of TransferDetail JSON objects. Each TransferDetail captures the transfer state at a point in time. Each TransferDetail contains all the usual attributes, except that the steps_html attribute is empty.

If your handler fails to respond with a 200 status code, WingCash will try to call the handler again later. When WingCash tries again, it will send the transfer state captured at the original point in time, even though the state may already be superseded by later transfer states. Because of the nature of the Web, your app should expect some out-of-order and duplicate webhook calls. Use the activity_count TransferDetail attribute to detect when states arrive out of order.