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.
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
Now, let’s begin coding! Add the packages and paste the code where you require and replace your credentials obtained on the previous step.
//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.Rows [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.
On twilio you can customize the way the message would appear and layout stuffs are cool. The output should be similar to this.
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 🤓
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.
About 2 hours to place the code.