Today, you’ll learn everything you need to know to send messages to WhatsApp channels 📲 and keep your audience engaged and up-to-date! 🚀
🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and get started in minutes!
This will allow us to perform the following deliveries
- Send text messages
- Send scheduled text messages
- Send a file
- Send images
- Send videos
- Send polls
- Send Scheduled polls
Manage Channels
- Create a channel
- Get channel messages
- Update channel information
Requirements
- Having a WhatsApp number already linked to the platform and online.
- Channel WhatsApp ID (WID) that you can find in two ways:
- On your WhatsApp number’s management panel, go to “Groups”. From there you will see the channels your number has access to.
- By using the API, query the available channels in your device for this endpoint.
API endpoint
In this tutorial we will use the following API endpoint:
Explore how to use the code in your browser without installing any software.
Also, you can find different languages you can test on Replit.com:
Send text messages using C# (RestClient)
// This code requires you to have installed RestSharp package. // Documentation: https://restsharp.dev // Installation: https://www.nuget.org/packages/RestSharp
using RestSharp;
class Program { static void Main(string[] args) { // Define the API endpoint var apiUrl = "https://api.wassenger.com/v1/messages";
// Create a RestClient instance
var client = new RestClient(apiUrl);
// Create a POST request
var request = new RestRequest(Method.POST);
// Set headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR\_API\_KEY\_HERE"); // Replace with your actual API key
// Set the message payload
var payload = new
{
channel = "{{channel}}", // Replace with the desired channel ID
message = "This is a sample message sent to a channel"
};
request.AddJsonBody(payload);
// Execute the request and get the response
IRestResponse response = client.Execute(request);
// Output the response
Console.WriteLine($"Response Status: {response.StatusCode}");
Console.WriteLine($"Response Content: {response.Content}");
}
}
Send text messages using C# (HttpClient)
// This code uses the built-in HttpClient package in the .NET framework. // Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System; using System.Net.Http; using System.Net.Http.Headers; using System.Threading.Tasks;
class Program { static async Task Main(string[] args) { // Define the API endpoint string apiUrl = "https://api.wassenger.com/v1/messages";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR\_API\_KEY\_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\\"channel\\":\\"{{channel}}\\",\\"message\\":\\"This is a sample message sent to a channel\\"}")
{
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch (HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
Send scheduled text messages using C# (RestClient)
// This code requires you to have installed RestSharp package.
// Documentation: https://restsharp.dev
// Installation: https://www.nuget.org/packages/RestSharp
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint
var client = new RestClient("https://api.wassenger.com/v1/messages");
// Create a POST request
var request = new RestRequest(Method.POST);
// Set headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the request body
request.AddParameter("application/json",
"{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a scheduled message to be sent tomorrow to a channel.Date format is based on ISO 8601 format with default UTC time zone\", \"deliverAt\":\"2024-12-06T00:00:30.433Z\"}",
ParameterType.RequestBody);
// Execute the request and get the response
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Send scheduled text messages using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Define the API endpoint
string apiUrl = "https://api.wassenger.com/v1/messages";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a scheduled message to be sent tomorrow to a channel.Date format is based on ISO 8601 format with default UTC time zone\", \"deliverAt\":\"2024-12-06T00:00:30.433Z\"}")
{
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and get started in minutes!
Send a file to WhatsApp channels using C# (RestClient)
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint
var client = new RestClient("https://api.wassenger.com/v1/messages");
// Create a POST request
var request = new RestRequest(Method.POST);
// Set headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the request body
request.AddParameter("application/json",
"{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a caption for the PDF message\", \"media\":{\"url\":\"https://www.africau.edu/images/default/sample.pdf\", \"expiration\":\"30d\"}}",
ParameterType.RequestBody);
// Execute the request and get the response
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Send a file to WhatsApp channels using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Define the API endpoint
string apiUrl = "https://api.wassenger.com/v1/messages";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a caption for the PDF message\", \"media\":{\"url\":\"https://www.africau.edu/images/default/sample.pdf\", \"expiration\":\"30d\"}}", )
{
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Send an image to channels using C# (RestClient)
// This code requires you to have installed RestSharp package.
// Documentation: https://restsharp.dev
// Installation: https://www.nuget.org/packages/RestSharp
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint
var client = new RestClient("https://api.wassenger.com/v1/messages");
// Create a POST request
var request = new RestRequest(Method.POST);
// Set headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the request body
request.AddParameter("application/json",
"{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a caption for an image message\", \"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\", \"viewOnce\":false}}",
ParameterType.RequestBody);
// Execute the request and get the response
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Send an image to channels using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Define the API endpoint
string apiUrl = "https://api.wassenger.com/v1/messages";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a caption for an image message\", \"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\", \"viewOnce\":false}}")
{
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
Send a video to channels using C# (RestClient)
// This code requires you to have installed RestSharp package.
// Documentation: https://restsharp.dev
// Installation: https://www.nuget.org/packages/RestSharp
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint
var client = new RestClient("https://api.wassenger.com/v1/messages");
// Create a POST request
var request = new RestRequest(Method.POST);
// Set headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the request body
request.AddParameter("application/json",
"{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a caption for a video message\", \"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\", \"viewOnce\":false}}",
ParameterType.RequestBody);
// Execute the request and get the response
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Send a video to channels using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Define the API endpoint
string apiUrl = "https://api.wassenger.com/v1/messages";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"channel\":\"123000098765421000@newsletter\", \"message\":\"This is a caption for a video message\", \"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\", \"viewOnce\":false}}")
{
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
Send a polls using C# (RestClient)
// This code requires you to have installed RestSharp package.
// Documentation: https://restsharp.dev
// Installation: https://www.nuget.org/packages/RestSharp
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint
var client = new RestClient("https://api.wassenger.com/v1/messages");
// Create a POST request
var request = new RestRequest(Method.POST);
// Set headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the request body
request.AddParameter("application/json",
"{\"channel\":\"123000098765421000@newsletter\", \"poll\":{\"name\":\"Vote for your favorite color\", \"options\":[\"Red\", \"Green\", \"Blue\", \"Yellow\", \"Grey\", \"Black\", \"Orange\", \"Purple\", \"White\"]}}",
ParameterType.RequestBody);
// Execute the request and get the response
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Send a poll using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Define the API endpoint
string apiUrl = "https://api.wassenger.com/v1/messages";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"channel\":\"123000098765421000@newsletter\", \"poll\":{\"name\":\"Vote for your favorite color\", \"options\":[\"Red\", \"Green\", \"Blue\", \"Yellow\", \"Grey\", \"Black\", \"Orange\", \"Purple\", \"White\"]}}")
{
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Send a scheduled poll using C# (RestClient)
// This code requires you to have installed RestSharp package.
// Documentation: https://restsharp.dev
// Installation: https://www.nuget.org/packages/RestSharp
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint
var client = new RestClient("https://api.wassenger.com/v1/messages");
// Create a POST request
var request = new RestRequest(Method.POST);
// Set headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the request body
request.AddParameter("application/json",
"{\"channel\":\"123000098765421000@newsletter\", \"deliverAt\":\"2024-12-06T00:00:30.433Z\", \"poll\":{\"name\":\"Vote for your favorite color\", \"options\":[\"Red\", \"Green\", \"Blue\", \"Yellow\", \"Grey\", \"Black\", \"Orange\", \"Purple\", \"White\"]}}",
ParameterType.RequestBody);
// Execute the request and get the response
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Send a scheduled poll using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Define the API endpoint
string apiUrl = "https://api.wassenger.com/v1/messages";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"channel\":\"123000098765421000@newsletter\", \"deliverAt\":\"2024-12-06T00:00:30.433Z\", \"poll\":{\"name\":\"Vote for your favorite color\", \"options\":[\"Red\", \"Green\", \"Blue\", \"Yellow\", \"Grey\", \"Black\", \"Orange\", \"Purple\", \"White\"]}}")
{
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and get started in minutes!
Manage Channels
Create a WhatsApp channel using C# (RestClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint for creating a channel
var client = new RestClient("https://api.wassenger.com/v1/devices/$device_id/channels");
// Create a POST request
var request = new RestRequest(Method.POST);
// Add required headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the JSON payload for the new channel
request.AddParameter("application/json",
"{\"name\":\"Channel name\", \"description\":\"This is a channel sample description, up to 2048 characters allowed\", \"image\":{\"url\":\"https://picsum.photos/600\"}}",
ParameterType.RequestBody);
// Execute the request
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Create a WhatsApp channel using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// API endpoint for creating a channel
string apiUrl = "https://api.wassenger.com/v1/devices/$device_id/channels";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Post, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"name\":\"Channel name\", \"description\":\"This is a channel sample description, up to 2048 characters allowed\", \"image\":{\"url\":\"https://picsum.photos/600\"}}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
Get channel messages using C# (RestClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint for fetching messages
var client = new RestClient("https://api.wassenger.com/v1/chat/$channel_id/messages?size=50");
// Create a GET request
var request = new RestRequest(Method.GET);
// Set the required headers
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Execute the request
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Get channel messages using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// API endpoint for fetching messages
string apiUrl = "https://api.wassenger.com/v1/chat/$channel_id/messages?size=50";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Get, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
Update channel information using C# (RestClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using RestSharp;
class Program
{
static void Main(string[] args)
{
// API endpoint for updating a channel
var client = new RestClient("https://api.wassenger.com/v1/devices/$device_id/channels/{{channel}}");
// Create a PATCH request
var request = new RestRequest(Method.PATCH);
// Add required headers
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "YOUR_API_KEY_HERE"); // Replace with your actual API key
// Set the JSON payload for the update
request.AddParameter("application/json", "{\"name\":\"New channel name\", \"description\":\"This is a new channel sample description\"}", ParameterType.RequestBody);
// Execute the request
IRestResponse response = client.Execute(request);
// Output the response content
Console.WriteLine($"Response Content: {response.Content}");
}
}
Update channel information using C# (HttpClient)
// This code uses the built-in HttpClient package in the.NET framework.
// Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=net-6.0
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// API endpoint for updating a channel
string apiUrl = "https://api.wassenger.com/v1/devices/$device_id/channels/{{channel}}";
// Create an instance of HttpClient
using var client = new HttpClient();
// Create the request message
var request = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
{
Headers =
{
{ "Token", "YOUR_API_KEY_HERE" } // Replace with your actual API key
},
Content = new StringContent("{\"name\":\"New channel name\", \"description\":\"This is a new channel sample description\"}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
try
{
// Send the request and get the response
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode(); // Throw if the status code is not successful
// Read and print the response body
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseBody}");
}
catch(HttpRequestException e)
{
Console.WriteLine($"Request error: {e.Message}");
}
}
}
Live API testing
You can live-test and play with the API directly from your browser.
Once you are done testing, you can get the auto-generated code example in your preferred programming language, and you will be ready to go.
🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and get started in minutes!
FAQs
How do I send messages to multiple channels?
You have to send multiple API requests, one per target channel.
For instance, if you want to send a message to 10 channels, you should send 10 independent HTTPS requests to the API.
There is no option to send multiple messages in a single API request.
What type of messages can be sent?
You can only send different types of text and image messages for channels.
Check out other tutorials for more information.
Looking for more answers? Check out the extended FAQs.
Further useful resources
API Documentation
For more details about the endpoint API, please check the documentation, which contains information about the accepted request parameters, possible success or error responses, and ready-to-use code examples in multiple programming languages.







