Text Messages
Send plain text messages to any WhatsApp user. Text messages support optional URL previews and can be up to 4,096 characters long.
Endpoint
POST
/api/messages/text
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone number with country code (e.g., "15551234567") |
body | string | Yes | The text content of the message (max 4,096 characters) |
previewUrl | boolean | No | Set to true to enable URL preview if the message contains a link |
phoneNumberId | string | No | Send from a specific number (uses default if omitted) |
Example Request
POST /api/messages/text HTTP/1.1
Host: app.waconnect.me
X-API-Key: wba_YOUR_API_KEY_HERE
Content-Type: application/json
{
"to": "15551234567",
"body": "Hello! This is a test message from WaConnect.",
"previewUrl": false
}HTTP
Example Response
{
"success": true,
"messageId": "wamid.HBgLMTU1NTEyMzQ1NjcVAgASGCA0",
"to": "15551234567",
"type": "text"
}JSON
C# Example
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace WhatsAppIntegration
{
class Program
{
private static readonly HttpClient client = new HttpClient();
private const string ApiUrl = "https://app.waconnect.me/api/messages/text";
private const string ApiKey = "wba_YOUR_API_KEY_HERE";
static async Task Main(string[] args)
{
var payload = new
{
to = "15551234567", // Recipient with country code
body = "Hello from C#!", // Message text
previewUrl = false
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
// Add authentication header
client.DefaultRequestHeaders.Add("X-API-Key", ApiKey);
try
{
HttpResponseMessage response = await client.PostAsync(ApiUrl, content);
string responseBody = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Message sent successfully!");
Console.WriteLine(responseBody);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
Console.WriteLine(responseBody);
}
}
catch (Exception ex)
{
Console.WriteLine($"Exception: {ex.Message}");
}
}
}
}C#
ⓘ
Tip: Use the Chat Simulator in your Dashboard to test text messages interactively before integrating with code.