Sample VSTS WebHook WebAPI with Basic Authentication
This sample repo shows a WebAPI WebHook project that responds to VSTS web hooks. This sample includes a BasicAuthHandler that checks for a basic auth header before allowing the webhook.
- Compile the solution in VS
- Set the username, password and code you want in the
- Override a
VstsWebHookHandlerBasemethod in the VSTSHookHandler.cs class to respond to those events (only
workitem.createdis currently stubbed)
- Run by using F5
- Open Postman
- To import the IISExpress self-signed cert, open the running URL in IE and proceed to the site. Click on the Lock icon and import the certificate to
Trusted Root Certification Authoritiesand restart Chrome.
- Set url to
- Add a basic auth header using the username/password you specified in the
- Go to the Team Services service hooks events page and grab a sample payload for an event that you have implemented in VSTSHookHandler.cs
- Copy this into the
Bodysection of the
POST, set the radio to
rawand set the type to
- Click Send and you should get a 200!