
This class will contain the APIUrl and token fields that are necessary for working with API. Public WaApi(string aPIUrl, string token) Here is how you create the WaApi class: public class WaApi In this chapter, we will look at how to write the class responsible for communication with our API gateway. Then open messengers on your phone and go to Settings -> messengers Web -> Scan the QR Code. To do this, go to your User Account and get the QR code.

Now you are supposed to connect messengers to your script so you could check the code while you are writing it.

You need to add methods of working with API WA and other utility classes that you will use. Now specify the domain base path.Īt this stage, the controller is practically ready. The Route attribute is responsible for the address which the controller will serve. Public class WebHookController : ControllerBase The controller must inherit the ControllerBase class and be marked by the attributes using To do this, create a Controllers folder within the project - this is where you will create a WebHookController class.

Next up, you’ll need to write the controller itself. This will allow you to use navigation via controller. Open the Startup.cs file and implement the Configure method: public void Configure(IApplicationBuilder app, IWebHostEnvironment env) In our example though, for illustrative purposes, we will develop the project from scratch. You can also choose an API template that already includes all the necessary controllers - then you will only have to edit them. Open Visual Studio and create a project with the name "ASP.NET Core Web App".

