How to Schedule Messages on WhatsApp with C# (.NET): The Easy Guide
In this tutorial, you will learn how to schedule the delivery of messages using the API.
There are two ways to schedule the delivery of a message to a later time and/or day: by specifying the exact day and time you want it to be sent or by indicating how many minutes, hours or days you’d like to delay the deferred delivery.
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
If you want 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
- Having a WhatsApp number already linked to the platform and online.
- Message recipient phone number with international prefix in E164 format. Example:
+393517224449
. You can validate the phone number here.
API endpoint
In this tutorial we will use the following API endpoint:
Prepare the request
Target API URL (POST
)
https://api.wassenger.com/v1/messages
Required HTTPS headers
Content-Type: application/json
Token: ENTER API KEY HERE
Send a message at a specific date in ISO8601 format
Request body example
// 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", "{\"phone\":\"+12345678909\",\"message\":\"This is a scheduled message to be sent to a phone number in 10 minutes\",\"deliverAt\":\"2025-01-07T12:29:03.131Z\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
You can also send scheduled messages to a group chat:
// 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\":\"${group_id}@g.us\",\"message\":\"This is a scheduled message to be sent tomorrow to a group chat. Date format is based on ISO 8601 format with default UTC time zone\",\"deliverAt\":\"2025-01-08T12:19:03.131Z\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Defer message delivery by minutes, hours or days
Request body example in JSON format
Valid examples values would be: 1m
= in 1 minute, 2h
= in 2 hours, 15d
= in 15 days.
Values must be whole numbers, so if you need to schedule a message for 1,5 hours, for example, you have to specify 90m
= in 90 minutes
// 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", "{\"phone\":\"+12345678909\",\"message\":\"This is a scheduled message to be sent to a phone number in 10 minutes\",\"delayTo\":\"8h"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Alternatively, you can delay the message delivery by a given amount of seconds:
// 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", "{\"phone\":\"+12345678909\",\"message\":\"This is a scheduled message to be sent to a phone number in 10 minutes\",\"delayTo\":\"180"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Live API testing
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 😎
Have questions? Please check out the frequently asked questions below.
FAQs
How to send messages to multiple phone numbers
You just have to send multiple API requests, one per target phone number.
For instance, if you want to send a message to 10 phone numbers, 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 send different types of messages, including text, images, videos, emojis, audio, gifs, geographic locations and file documents via API.
Check out other tutorials for more information.
How to validate if a phone number can receive WhatsApp messages
You can validate if a given phone number is linked to a WhatsApp account and can receive messages.
The API provides an endpoint that can validate whether a given phone number exists in WhatsApp or not.
The only requirement is to have at least one WhatsApp number connected to the platform in your current account.
For more details, please check out the API endpoint documentation here.
Before you check if a phone number exists on WhatsApp, you can also validate and normalize the format of a list of phone numbers by using the numbers validator API endpoint. This endpoint only validates the correct E164 format, but it does not check whether the phone number effectively exists on WhatsApp or not.
Note: The number of WhatsApp check validations is limited per month based on your subscription plan. Please check out the pricing table for more details about the limits.
Looking for more answers? Check out the extended FAQs.
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Further useful resources
API Documentation
For more details about the endpoint API, please check the document where you will find all the details about the accepted request params, possible success or error responses and ready-to-use code examples in multiple programming languages.