This article shows you how to send a WhatsApp message in Microsoft’s .net language: C#.
Before the recipient can receive your WhatsApp message, she will need to register with the WhatsMate WA Gateway. Instructions are available on the official site. Unregistered users will never receive messages from the Gateway.
To send a WhatsApp message in C#, do this:
- Copy the following source code to the main class in your Console Application in Visual Studio.
- Customize the TODO lines:
- Specify your gateway instance ID on line 10.
- Specify your client ID and secret on lines 11 and 12.
- Specify your target recipient and message on line 19. Remember to include the country code in the recipient’s number.
- Add the reference “System.Web.Extensions” by doing this:
- Right-click on your project node in the Solution Explorer panel.
- Choose “Add” -> “Reference…”
- Choose “Framework” on the left pane.
- Look for “System.Web.Extensions” in the middle pane. Check the checkbox in front of it.
- Click OK.
- Build and run the application in Visual Studio.
You will need a trial account to call the above API. Go sign up now.