Skip to content

XeroAPI/Xero-NetStandard-Webhooks-Receiver

Repository files navigation

Xero Webhook Receiver - NetStandard

This application demonstrates how to receive webhooks from Xero.

Application Features

  1. Accept a POST request from Xero
  2. Verify payload signature
  3. Store payload to a queue
  4. Return correct HTTP status code
  5. Background worker for asynchronous processing of payload queue

Running Application

Prerequisites

  • A private or partner app connected to at least one Xero Organisation, to generate webhook events, if you don't have a xero app you can create one for free at the developer portal
  • Ngrok, to tunnel network traffic to localhost

From Source

  1. Clone this repository
  2. Open solution in a compatible IDE (e.g. Visual Studio Code)
  3. Update appsettings.json with your app webhook key
  4. Build and run solution, note, no front-end changes have been made, so, site will be default MVC home view
  5. Make server accessible to Xero using ngrok

Making your server accessible from Xero (Ngrok)

  1. Download ngrok using this guide
  2. Set you app's webhook delivery URL to {negrok_address}/webhooks (e.g. https://daaf38b6.ngrok.io/webhooks) in the developer portal
  3. Create or modify any contact or invoice in a Xero Organisation connected to your app and wait for the event to arrive, solution will display info in console

Solution Structure

Directory Description
DTO 'Data-Transfer-Object', holds classes that model a Xero webhook payload
Config Holds a class that the models webhook settings from appsettings.json

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages