Send Automated WhatsApp Audio Messages With C NET

April 15, 2025

Do you need help with customer inquiries, promotions, and updates you must send? Imagine if you could automate these tasks, like sending audio voice-like recording messages on WhatsApp directly to customers or group chats, to get everything done quickly and efficiently. With Wassenger, this is easily done!

🤩 🤖 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!

Whether it’s a reminder, notification, or promotion, your audio messages ensure effective delivery and improve the customer experience. Using audio instead of text also saves time and offers a better user experience.

In this tutorial, we’ll guide you step-by-step on how to set up and use the Wassenger API to automate the delivery of WhatsApp audio (voice recording-like) messages to🚀

Here are ready-to-use code examples in C# (RestClient and httpClient)

🫣 Don’t want to use programming? No problem! Explore our new no-code WhatsApp Campaigns feature. Import your contacts, define a message, set a delivery date and relax! 🥳 🥳

This tutorial will teach you how to send audio messages to phone numbers and group chat lists using the API.

You can send audio files in any of the following: MP3, OGG, MP4, ACC.

If you need to send messages from code, you can use any programming language to perform HTTPS API requests. Below is the live API tester with ready-to-use code examples in various programming languages.

Requirements

API endpoints

In this tutorial, we will use the following API endpoint:

You can send audio messages in a single API request by passing the remote URL where the file is stored. Click here to test it

Send audio message from URL

To send an audio message like a voice-recoding audio (PTT or Push-To-Talk) as a multimedia message, in this case, an audio file, you should provide a remote public URL (Internet reachable) pointing to the audio file content.

To send an audio message (PTT) by using the following methods using the API:

  • Remote URL using JSON with a url field with the publicly accessible URL to download the audio file.

Example audio MP3 audio file to use

https://download.samplelib.com/mp3/sample-9s.mp3

Note: in case the URL is not publicly accessible, it returns a non-valid HTTP status (>=400) or it returns non-binary content, such as HTML or text, the API will return an error.

Target API URL (POST)

https://api.wassenger.com/v1/messages

Required HTTPS headers

Content-Type: application/json
Token: $API-TOKEN

Request body in JSON format

{
  "phone": "+1234567890",
  "media": {
    "url": "https://download.samplelib.com/mp3/sample-9s.mp3",
    "format": "ptt"
  }
}

Depending on the programming language or HTTP client software you are using, the process might vary. To make it simpler, we need to highlight the most popular tools, such as Postman, and any other programming languages.

🤩 🤖 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 getting started in minutes!

Send audio using code

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:

  • C# (RestClient)
// This code requires you to have installed RestSharp package.
// Documentation: https://restsharp.dev
// Installation: https://www.nuget.org/packages/RestSharp
var client = new RestClient("https://api.wassenger.com/v1/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "API KEY GOES HERE");
request.AddParameter("application/json", "{\"phone\":\"+12345678909\", \"media\":{\"url\":\"https://download.samplelib.com/mp3/sample-9s.mp3\", \"format\":\"ptt\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
  • 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.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post, 
RequestUri = new Uri("https://api.wassenger.com/v1/messages"), 
Headers =
{
{ "Token", "API KEY GOES HERE" }, 
}, 
Content = new StringContent("{\"phone\":\"+12345678909\", \"media\":{\"url\":\"https://download.samplelib.com/mp3/sample-9s.mp3\", \"format\":\"ptt\"}}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using(var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}

🤩 🤖 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 getting started in minutes!

Send audio messages to a phone number

Sending a new media message via API is easy; you simply need to know the target phone number in E164 format and the audio file URL.

You can send messages to any phone number worldwide that has a WhatsApp account, there is no need to add a phone number as a contact in your mobile device agenda or contact list.

Send audio messages to a group chat on WhatsApp

Similar to the previous scenario, you can also send media messages to group chats.

To do so, you need to know the target group chat ID and the audio file remote URL.

To send messages to a group, you must be a participant of it with send message permissions. If you are the not the administrator of the group, you should permission to send messages.

Prepare the request

Target API URL (POST)

https://api.wassenger.com/v1/messages

Required HTTPS headers

Content-Type: application/json
Token: $API_KEY

Request body in JSON format

Sending a message to a group chat:

{
  "group": "1234567890-100000000@g.us",
  "media": {
    "url": "https://download.samplelib.com/mp3/sample-9s.mp3",
    "format": "ptt"
  }
}

Send audio messages to a WhatsApp Channel

Similar to the previous scenario, you can also send media messages to WhatsApp Channels.

To do so, you need to know the target WhatsApp Channel ID and the audio file URL.

To send messages to a WhatsApp Channel, you must be the owner of the channel.

Target API URL (POST)

https://api.wassenger.com/v1/messages

Required HTTPS headers

Content-Type: application/json
Token: $API_KEY

Request body in JSON format

Sending a message to a WhatsApp Channel:

{
  "channel": "12345678901234567@newsletter",
  "media": {
    "url": "https://download.samplelib.com/mp3/sample-9s.mp3",
    "format": "ptt"
  }
}

Send audio using code to a WhatsApp group

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:

  • C# (RestClient)
// This code requires you to have installed RestSharp package.
// Documentation: https://restsharp.dev
// Installation: https://www.nuget.org/packages/RestSharp
var client = new RestClient("https://api.wassenger.com/v1/messages");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Token", "API KEY GOES HERE");
request.AddParameter("application/json", "{\"group\":\"1234567890987654321@g.us\", \"media\":{\"url\":\"https://download.samplelib.com/mp3/sample-9s.mp3\", \"format\":\"ptt\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
  • 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.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post, 
RequestUri = new Uri("https://api.wassenger.com/v1/messages"), 
Headers =
{
{ "Token", "API KEY GOES HERE" }, 
}, 
Content = new StringContent("{\"group\":\"1234567890987654321@g.us\", \"media\":{\"url\":\"https://download.samplelib.com/mp3/sample-9s.mp3\", \"format\":\"ptt\"}}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using(var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}

Live test sends media messages using the API

You can now play, debug and live test the API directly from your browser, explore and try more API examples and get in one click ready-to-use code snippets available in 15+ different programming languages 😎

Test the API live tester

🤩 🤖 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 getting started in minutes!

FAQ

Can I use Wassenger for chatbots?

Yes, you can build your chatbot with our API and webhooks. To do so, you need to subscribe to any Platform plan allowing you to implement chatbots on top of the API.

Explore more in our related article here.

What type of media files can be sent?

You can send images (JPEG, PNG, WEBP), videos (MP4, 3GPP), audios (MP3, OGG, MP4, ACC), gifs (MP4) and documents (PDF, PPT, PPTX, DOCX, DOC, ZIP, RAR, other binary types).

Check out the API documentation for more details.

How can I validate phone numbers?

You can validate whether a given phone number exists in WhatsApp or not, and therefore can receive messages in WhatsApp, by using the Number exists API endpoint.

Please note that you must have at least one WhatsApp number connected to the platform to perform the validation.

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, where you will find all the details about the accepted request parameters, possible success or error responses and ready-to-use code examples in multiple programming languages:

https://app.wassenger.com/docs/#tag/Files

Ready to transform your WhatsApp communication?

Start automating your customer interactions today with Wassenger

Get Started Free