left-icon

ASP.NET WebHooks Succinctly®
by Gaurav Arora

Previous
Chapter

of
A
A
A

CHAPTER 7

Tips & Tricks

Tips & Tricks


In this chapter we are going to discuss few tips and tricks for ASP.NET WebHooks. These tips and tricks will be helpful when you try to implement or customize WebHooks.

Working locally

In Chapter 2, we discussed the importance of SSL with public URL, and we deployed our sample applications to Azure as a Web APP. It is not possible or practical to create and deploy your application to Azure every time just for testing. To resolve this issue, there is a helpful tool that allows you to work locally to test your applications: ngrock. A full discussion is beyond the scope of this book, but you can get full details form the project’s site.

Visual Studio extension

In Chapter 2, we discussed consuming WebHooks and went through the process of writing an application and deployment to Azure. While working well, this process takes time. Imagine if we had a tool that could helps us in a way similar to Plug and Play. There is a great Visual Studio extension available for this, which provides us an interface to set few configuration parameters and allow us to get notifications. You can get this extension here.

Most importantly, this is an open source extension, which mean you can add your own provider (if not listed in the extension). To do so, you just need to fork the repository and a create pull request for your provider.

Dependency injection implementation

ASP.NET WebHooks is built with the implementation of dependency injection, and you can use any dependency injection of your choice. For implementation, please refer to Dependency Scope Extension to know the list of all dependencies for Receivers. There is a default implementation, which is defined here: Receiver Services.

We are not going to explain our sample application, which is available on Chapter 7 of the Bitbucket repository.

Customizing logging framework

In Chapter 6, we discussed diagnostics where we went through the logging way of ASP.NET WebHooks. We also discuss the redirecting log by implementing any logging framework. We are not going to explain our sample application, which demonstrates the implementation of the Log4Net logging framework. You can find this sample application on Chapter 7 of the Bitbucket repository.

Consuming multiple WebHook receivers

In Chapter 2, we worked through consuming WebHook receivers, and covered the format of a valid URI and configuring a secret key. We also created a sample application to consume a WebHook receiver for single receiver. Our application can have multiple receivers at the same time. You can find the sample application on Chapter 7 of the Bitbucket repository

Similarly, we can use multiple configurations for a single WebHook receiver. For example, our Bitbucket WebHook receiver can be set for three different secret keys—this is demonstrated in our sample application, and is available here.

Customizing notifications

In section WebHook processing we discussed about processing of Webhook. Typically, data is JSON or HTML, but we can cast to a specific type. Here’s a typical example of Custom WebHook, where we demonstrate notifications to cast in CustomNotifications.

Scroll To Top
Disclaimer
DISCLAIMER: Web reader is currently in beta. Please report any issues through our support system. PDF and Kindle format files are also available for download.

Previous

Next



You are one step away from downloading ebooks from the Succinctly® series premier collection!
A confirmation has been sent to your email address. Please check and confirm your email subscription to complete the download.