Example code in asp.net for Bulk Whatsapp

Replace number, type, message, instance id and access token accordingly.

 

1. Below is the sample code for asp.net:

using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace WhatsAppSender
{
class Program
{
static async Task Main(string[] args)
{
string number = "9199XXXXXXXX";
string type = "text";
string message = "test message";
string instanceId = "6616XXXXX";
string accessToken = "661XXXXXX";

string apiUrl = $"https://whatsapponcloud.com/api/send?number={Uri.EscapeDataString(number)}" +
$"&type={Uri.EscapeDataString(type)}" +
$"&message={Uri.EscapeDataString(message)}" +
$"&instance_id={Uri.EscapeDataString(instanceId)}" +
$"&access_token={Uri.EscapeDataString(accessToken)}";

using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(apiUrl);

if (response.IsSuccessStatusCode)
{
string apiResponse = await response.Content.ReadAsStringAsync();
Console.WriteLine("API response: " + apiResponse);
}
else
{
Console.WriteLine("Error sending request. Status code: " + response.StatusCode);
}
}
}
}
}

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Example code in python for Bulk Whatsapp

Replace number, type, message, instance id and access token accordingly.   1. Below is the...

Example code in php for Bulk Whatsapp

Replace number, type, message, instance id and access token accordingly.   1. Below is the...

Example code in node.js for Bulk Whatsapp

Replace number, type, message, instance id and access token accordingly.   1. Below is the...

Example code in ruby for Bulk Whatsapp

Replace number, type, message, instance id and access token accordingly.   1. Below is the...

Example code in java for Bulk Whatsapp

Replace number, type, message, instance id and access token accordingly.   1. Below is the...