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🚀
- Send audio messages to WhatsApp phone numbers
- Send audio messages to a Group Chat
- Send audio messages to a WhatsApp Channel
Here are ready-to-use code examples in Python, C#, PHP, JavaScript, Ruby, Java, Go, and curl.
🫣 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
- A WhatsApp number linked to Wassenger. You can do it in minutes using your existing WhatsApp number by signing up for free here.
- Obtain your Wassenger API key here: sign-up required.
- Recipient phone number with international country prefix in E164 format or Group chat WhatsApp ID. Example phone number:
+12345678900. You can validate the phone number format here.
API endpoints
In this tutorial, we will use the following API endpoint:
- Send Message
- Upload File (optional, in case the audio file can’t be downloaded from a remote URL)
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 an audio message from a URL
To send an audio message like a voice-recording 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
urlfield 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", "ENTER API KEY HERE");
request.AddParameter("application/json", "{\"phone\":\"+1234567890\", \"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 TOKEN 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 to WhatsApp Groups
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 TOKEN GOES HERE");
request.AddParameter("application/json", "{\"group\":\"120363312495767890@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 TOKEN GOES HERE" },
},
Content = new StringContent("{\"group\":\"120363312495767890@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);
}
Send audio messages to a WhatsApp Channel
Similar to the previous scenario, you can also send media messages to WhatsApp Channels.
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 TOKEN GOES HERE");
request.AddParameter("application/json", "{\"channel\":\"120363312495767890@newsletter\", \"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 TOKEN GOES HERE" },
},
Content = new StringContent("{\"channel\":\"120363312495767890@newsletter\", \"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 😎
🤩 🤖 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 from 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:







