Wasend

Send Message

Send any type of message using the unified send endpoint

Send Message

Send any type of message (text, image, video, file, etc.) using the unified send endpoint.

Endpoint

POST /send

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesapplication/json

Request Body

FieldTypeRequiredDescription
sessionstringYesThe session ID
tostringYesRecipient's phone number in international format (e.g., "+1234567890")
textstringNoMessage text or caption
imageUrlstringNoURL of the image to send
videoUrlstringNoURL of the video to send
documentUrlstringNoURL of the document to send
audioUrlstringNoURL of the audio to send
mimetypestringNoMIME type of the media (e.g., "image/jpeg", "video/mp4")
filenamestringNoName of the file to send
previewobjectNoCustom link preview information ({[ key: string ]: string})

Response

{
  "id": "string",
  "content": "string",
  "type": "string",
  "timestamp": "string",
  "status": "string",
  "fromMe": boolean,
  "sender": "string",
  "to": "string",
  "recipient": "string"
}

Examples

# Send a text message
curl -X POST "https://api.wasend.dev/send" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session": "sessionId",
    "to": "+1234567890",
    "text": "Hello from WASend!"
  }'

# Send an image
curl -X POST "https://api.wasend.dev/send" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session": "sessionId",
    "to": "+1234567890",
    "imageUrl": "https://example.com/image.jpg",
    "text": "Check out this image!",
    "mimetype": "image/jpeg"
  }'
import { WasendClient } from '@wasend/core';

const client = new WasendClient({
  apiKey: 'YOUR_API_KEY',
  baseUrl: 'https://api.wasend.dev'
});

// Send a text message
const textMessage = await client.send({
  session: "sessionId",
  to: "+1234567890",
  text: "Hello from WASend!"
});

// Send an image
const imageMessage = await client.send({
  session: "sessionId",
  to: "+1234567890",
  imageUrl: "https://example.com/image.jpg",
  text: "Check out this image!",
  mimetype: "image/jpeg"
});
const { WasendClient } = require('@wasend/core');

const client = new WasendClient({
  apiKey: 'YOUR_API_KEY',
  baseUrl: 'https://api.wasend.dev'
});

// Send a text message
const textMessage = await client.send({
  session: "sessionId",
  to: "+1234567890",
  text: "Hello from WASend!"
});

// Send an image
const imageMessage = await client.send({
  session: "sessionId",
  to: "+1234567890",
  imageUrl: "https://example.com/image.jpg",
  text: "Check out this image!",
  mimetype: "image/jpeg"
});
from wasend import WasendClient

client = WasendClient(
    api_key='YOUR_API_KEY',
    base_url='https://api.wasend.dev'
)

# Send a text message
text_message = client.send(
    session="sessionId",
    to="+1234567890",
    text="Hello from WASend!"
)

# Send an image
image_message = client.send(
    session="sessionId",
    to="+1234567890",
    image_url="https://example.com/image.jpg",
    text="Check out this image!",
    mimetype="image/jpeg"
)
package main

import (
	"fmt"
	"github.com/wasenddev/wasend-sdk-go/wasendcore"
)

func StringPtr(s string) *string    { return &s }
func Float64Ptr(f float64) *float64 { return &f }

func main() {
	client := wasendcore.NewWasendClient(&wasendcore.WasendConfig{
		ApiKey:  StringPtr("YOUR_API_KEY"),
		BaseUrl: StringPtr("https://api.wasend.dev"),
	})

	// Send a text message
	textMessage := client.Send(&wasendcore.SendRequest{
		Session: StringPtr("sessionId"),
		To:      StringPtr("+1234567890"),
		Text:    StringPtr("Hello from WASend!"),
	})
	fmt.Printf("Text message sent: %+v\n", textMessage)

	// Send an image
	imageMessage := client.Send(&wasendcore.SendRequest{
		Session:  StringPtr("sessionId"),
		To:       StringPtr("+1234567890"),
		ImageUrl: StringPtr("https://example.com/image.jpg"),
		Text:     StringPtr("Check out this image!"),
		Mimetype: StringPtr("image/jpeg"),
	})
	fmt.Printf("Image message sent: %+v\n", imageMessage)
}
using Wasend.Core;

var config = new WasendConfig
{
    ApiKey = "your-api-key-here" // Required
    // BaseUrl and Timeout are optional and have default values
};

var client = new WasendClient(config);

// Send a text message
var textMessage = client.Send(new SendRequest
{
    Session = "sessionId",
    To = "+1234567890",
    Text = "Hello from WASend!"
});

// Send an image
var imageMessage = client.Send(new SendRequest
{
    Session = "sessionId",
    To = "+1234567890",
    ImageUrl = "https://example.com/image.jpg",
    Text = "Check out this image!",
    Mimetype = "image/jpeg"
});
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.net.http.HttpRequest.BodyPublishers;
import org.json.JSONObject;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        
        // Send a text message
        JSONObject textBody = new JSONObject()
            .put("session", "sessionId")
            .put("to", "+1234567890")
            .put("text", "Hello from WASend!");
            
        HttpRequest textRequest = HttpRequest.newBuilder()
            .uri(URI.create("https://api.wasend.dev/send"))
            .header("Authorization", "Bearer YOUR_API_KEY")
            .header("Content-Type", "application/json")
            .POST(BodyPublishers.ofString(textBody.toString()))
            .build();

        HttpResponse<String> textResponse = client.send(textRequest, HttpResponse.BodyHandlers.ofString());
        System.out.println("Text message response: " + textResponse.body());

        // Send an image
        JSONObject imageBody = new JSONObject()
            .put("session", "sessionId")
            .put("to", "+1234567890")
            .put("imageUrl", "https://example.com/image.jpg")
            .put("text", "Check out this image!")
            .put("mimetype", "image/jpeg");
            
        HttpRequest imageRequest = HttpRequest.newBuilder()
            .uri(URI.create("https://api.wasend.dev/send"))
            .header("Authorization", "Bearer YOUR_API_KEY")
            .header("Content-Type", "application/json")
            .POST(BodyPublishers.ofString(imageBody.toString()))
            .build();

        HttpResponse<String> imageResponse = client.send(imageRequest, HttpResponse.BodyHandlers.ofString());
        System.out.println("Image message response: " + imageResponse.body());
    }
}
<?php
$ch = curl_init();

// Send a text message
$textData = [
    'session' => 'sessionId',
    'to' => '+1234567890',
    'text' => 'Hello from WASend!'
];

curl_setopt($ch, CURLOPT_URL, "https://api.wasend.dev/send");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer YOUR_API_KEY",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($textData));

$textResponse = curl_exec($ch);
echo "Text message response: " . $textResponse . "\n";

// Send an image
$imageData = [
    'session' => 'sessionId',
    'to' => '+1234567890',
    'imageUrl' => 'https://example.com/image.jpg',
    'text' => 'Check out this image!',
    'mimetype' => 'image/jpeg'
];

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($imageData));
$imageResponse = curl_exec($ch);
echo "Image message response: " . $imageResponse . "\n";

curl_close($ch);
require 'net/http'
require 'uri'
require 'json'

uri = URI('https://api.wasend.dev/send')

# Send a text message
text_data = {
  session: 'sessionId',
  to: '+1234567890',
  text: 'Hello from WASend!'
}

request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = text_data.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end
puts "Text message response: #{response.body}"

# Send an image
image_data = {
  session: 'sessionId',
  to: '+1234567890',
  imageUrl: 'https://example.com/image.jpg',
  text: 'Check out this image!',
  mimetype: 'image/jpeg'
}

request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = image_data.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end
puts "Image message response: #{response.body}"
import Foundation

let url = URL(string: "https://api.wasend.dev/send")!

// Send a text message
var textRequest = URLRequest(url: url)
textRequest.httpMethod = "POST"
textRequest.setValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
textRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")

let textData: [String: Any] = [
    "session": "sessionId",
    "to": "+1234567890",
    "text": "Hello from WASend!"
]
textRequest.httpBody = try? JSONSerialization.data(withJSONObject: textData)

let textTask = URLSession.shared.dataTask(with: textRequest) { data, response, error in
    if let data = data {
        print("Text message response: \(String(data: data, encoding: .utf8) ?? "")")
    }
}
textTask.resume()

// Send an image
var imageRequest = URLRequest(url: url)
imageRequest.httpMethod = "POST"
imageRequest.setValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
imageRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")

let imageData: [String: Any] = [
    "session": "sessionId",
    "to": "+1234567890",
    "imageUrl": "https://example.com/image.jpg",
    "text": "Check out this image!",
    "mimetype": "image/jpeg"
]
imageRequest.httpBody = try? JSONSerialization.data(withJSONObject: imageData)

let imageTask = URLSession.shared.dataTask(with: imageRequest) { data, response, error in
    if let data = data {
        print("Image message response: \(String(data: data, encoding: .utf8) ?? "")")
    }
}
imageTask.resume()
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION, CONTENT_TYPE};
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut headers = HeaderMap::new();
    headers.insert(
        AUTHORIZATION,
        HeaderValue::from_str("Bearer YOUR_API_KEY")?
    );
    headers.insert(
        CONTENT_TYPE,
        HeaderValue::from_str("application/json")?
    );

    let client = reqwest::Client::new();

    // Send a text message
    let text_body = json!({
        "session": "sessionId",
        "to": "+1234567890",
        "text": "Hello from WASend!"
    });

    let text_response = client
        .post("https://api.wasend.dev/send")
        .headers(headers.clone())
        .json(&text_body)
        .send()
        .await?
        .text()
        .await?;

    println!("Text message response: {}", text_response);

    // Send an image
    let image_body = json!({
        "session": "sessionId",
        "to": "+1234567890",
        "imageUrl": "https://example.com/image.jpg",
        "text": "Check out this image!",
        "mimetype": "image/jpeg"
    });

    let image_response = client
        .post("https://api.wasend.dev/send")
        .headers(headers)
        .json(&image_body)
        .send()
        .await?
        .text()
        .await?;

    println!("Image message response: {}", image_response);
    Ok(())
}

Response Fields

FieldTypeDescription
idstringUnique identifier for the message
contentstringContent of the message
typestringType of the message (text, image, video, etc.)
timestampstringWhen the message was sent
statusstringCurrent status of the message
fromMebooleanWhether the message was sent by you
senderstringSender's phone number
tostringThe recipient's phone number or group JID
recipientstringThe message recipient

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
404Not Found - Session or recipient not found
429Too many requests - Rate limit exceeded
500Internal server error

Notes

  • Phone numbers must be in international format (e.g., "+1234567890")
  • The @c.us suffix is automatically added by the API
  • For media messages, the URL must be publicly accessible
  • Supported media types: image, video, document, audio
  • Maximum file size: 16MB for media files
  • Maximum text length: 4096 characters