Whatsapp Business API Integration In C#

by Priyanka Arora
May 19, 2020
Whatsapp Business API Integration in C# is actually an exhaustive process for any developer solely because with the latest norms you cannot move onto the development process till you have verified business account for Facebook and hence, Whatsapp and verification could take from 2 days to 14 days. So, practically you have to wait 14 days to even start with the development and then, figure out how the messages would go and so on. Because of this limitation, there is some third-party software that allow to use the sandbox model and integrate the code before even you have verified the code. Blessing right. Here, we are using one such third party namely Twilio. One needs to install the NuGet package, and then can start using the sandbox model immediately. Though it has limitations as you can only test with one phone number and very few messages before you verify the business account. But still, that’s the best thing available. So, let’s dive straight into the tutorial.

1.Install NuGet Package

First step for Whatsapp business API integration in C# is to Open nuGet Package Console and type the below command to download the nuGet package.

install-Package twilio

2.Make Twilio Account

For Whatsapp business API integration in C sharp you need to have tokens. Next step is to sign up to twilio account and get twilio accountSID and AuthToken

Go to site:https://www.twilio.com/

Signup, enter your phone number and other basic details and you would get credentials on the console screen

3. Write the Code

Now, let’s begin coding! Add the packages and paste the code where you require and replace your credentials obtained on the previous step.

using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

//add the code into the function

   ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
   TwilioClient.Init(“Account SID”, “AUTH TOKEN”);
    from: new Twilio.Types.PhoneNumber(“whatsapp:+14155238886”),
    body: “Hello,!”,// link code
    // Convert.ToString(dsProfile.Tables[0].Rows[0]       [HealNTService.DOCUMENT_SERVER_URL]);

to: new Twilio.Types.PhoneNumber(“whatsapp:+919999999999”)

//replace your number here
catch (Exception ex)


Note for Sandbox model from would remain to be twilio number, and also write phone number with the international code as above otherwise it would throw exception. So, you go to replace three things above, authsid, auth token and your registered number with twilio. And it would send Whatsapp message onto the number.

4.Testing the Code on Whatsapp

On twilio you can customize the way the message would appear and layout stuffs are cool. The output should be similar to this.

5.Verifying Business Account

verifying business account is the last step how cool is thatThough you can’t use sandbox on production also just a few test messages are allowed.So, you go to verify the business account following the official link


That was a short and complete guide on the Whatsapp business API integration in C#. You should be good to go 🤓

Frequently Asked Questions

There is a big form to fill and verify detail of the owner as it contains sensitive information.

There are infact, and you can definitely use any.

Yes. But the account must be verified before itself.

Similar Posts

Whatsapp Business API Integration NodeJs
May 19, 2020, 1419 Views, 1
Express Js Routing Tutorial | Beginners
May 19, 2020, 1419 Views, 1
Mysql with NodeJs Connection and CRUD
May 19, 2020, 1419 Views, 1
Sql Server with NodeJs CRUD Operations
May 19, 2020, 1419 Views, 1

Comments Section

Nov 13, 2020

thanks mate