Wasend

Add Group Participants

Add new participants to a WhatsApp group

Add Group Participants

Add new participants to a specific WhatsApp group.

Endpoint

POST /{sessionId}/groups/{groupId}/participants/add

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
sessionIdstringYesThe session ID
groupIdstringYesThe group ID

Request Body

FieldTypeRequiredDescription
participantsstring[]YesList of participant IDs (phone numbers)
notifybooleanNoWhether to notify participants (default: true)

Response

{
  "success": true,
  "data": {
    "added": [
      {
        "id": "string", // Participant JID
        "reason": "string" // e.g., "SUCCESS"
      }
    ],
    "failed": [
      {
        "id": "string", // Participant JID
        "reason": "string" // e.g., "NOT_FOUND", "ALREADY_IN_GROUP"
      }
    ]
  }
}

Examples

curl -X POST "https://api.wasend.dev/{sessionId}/groups/{groupId}/participants/add" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "participants": [
      "+1234567890",
      "+0987654321"
    ],
    "notify": true
  }'
import { WasendClient } from '@wasend/core';

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

// Add participants to group
const result = await client.addGroupParticipants(sessionId, groupId, {
  participants: [
    "+1234567890",
    "+0987654321"
  ],
  notify: true
});

console.log('API Response:', result);
const { WasendClient } = require('@wasend/core');

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

// Add participants to group
const result = await client.addGroupParticipants(sessionId, groupId, {
  participants: [
    "+1234567890",
    "+0987654321"
  ],
  notify: true
});

console.log('API Response:', result);
from wasend import WasendClient

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

# Add participants to group
result = client.add_group_participants(
    session_id=sessionId,
    group_id=groupId,
    participants=[
        "+1234567890",
        "+0987654321"
    ],
    notify=True
)

print(result)
package main

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

func StringPtr(s string) *string { return &s }
func BoolPtr(b bool) *bool    { return &b }

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

	// Add participants to group
	result, err := client.AddGroupParticipants(sessionId, groupId, &wasendcore.ParticipantsRequest{
		Participants: []string{
			"+1234567890",
			"+0987654321",
		},
		Notify: BoolPtr(true),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("API Response: %+v\n", result)
}
using Wasend.Core;
using System.Collections.Generic;

var config = new WasendConfig
{
    ApiKey = "YOUR_API_KEY"
};
var client = new WasendClient(config);

// Add participants to group
var result = client.AddGroupParticipants(sessionId, groupId, new ParticipantsRequest
{
    Participants = new List<string> { "+1234567890", "+0987654321" },
    Notify = true
});

System.Console.WriteLine($"API Response: {result}");
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import org.json.JSONObject;
import org.json.JSONArray;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient httpClient = HttpClient.newHttpClient();
        String sessionId = "yourSessionId";
        String groupId = "yourGroupId";

        JSONObject requestBody = new JSONObject();
        JSONArray participantsArray = new JSONArray();
        participantsArray.put("+1234567890");
        participantsArray.put("+0987654321");
        requestBody.put("participants", participantsArray);
        requestBody.put("notify", true);

        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://api.wasend.dev/" + sessionId + "/groups/" + groupId + "/participants/add"))
                .header("Authorization", "Bearer YOUR_API_KEY")
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(requestBody.toString()))
                .build();

        HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println("Response: " + response.body());
    }
}
<?php

$sessionId = 'yourSessionId';
$groupId = 'yourGroupId';
$url = "https://api.wasend.dev/{$sessionId}/groups/{$groupId}/participants/add";

$data = [
    'participants' => [
        '+1234567890',
        '+0987654321'
    ],
    'notify' => true
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

?>
require 'net/http';
require 'uri';
require 'json';

session_id = 'yourSessionId'
group_id = 'yourGroupId'
uri = URI("https://api.wasend.dev/#{session_id}/groups/#{group_id}/participants/add")

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true # For HTTPS

request = Net::HTTP::Post.new(uri.request_uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = {
  participants: [
    "+1234567890",
    "+0987654321"
  ],
  notify: true
}.to_json

response = http.request(request)
puts "Response: #{response.body}"
import Foundation

let sessionId = "yourSessionId"
let groupId = "yourGroupId"
let url = URL(string: "https://api.wasend.dev/\(sessionId)/groups/\(groupId)/participants/add")!

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

let body: [String: Any] = [
    "participants": [
        "+1234567890",
        "+0987654321"
    ],
    "notify": true
]

request.httpBody = try? JSONSerialization.data(withJSONObject: body)

let task = URLSession.shared.dataTask(with: request) { data, response, error in
    if let data = data, let responseString = String(data: data, encoding: .utf8) {
        print("Response: \(responseString)")
    }
}
task.resume()
use reqwest::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let session_id = "yourSessionId";
    let group_id = "yourGroupId";
    let url = format!("https://api.wasend.dev/{}/groups/{}/participants/add", session_id, group_id);

    let response = client
        .post(&url)
        .header("Authorization", "Bearer YOUR_API_KEY")
        .header("Content-Type", "application/json")
        .json(&json!({
            "participants": [
                "+1234567890",
                "+0987654321"
            ],
            "notify": true
        }))
        .send()
        .await?
        .text()
        .await?;

    println!("Response: {}", response);
    Ok(())
}

Response Fields

FieldTypeDescription
successbooleanWhether the operation was successful
dataobjectObject containing lists of added and failed participants
data.addedarrayList of successfully added participants
data.failedarrayList of participants that could not be added

Added/Failed Participant Object

FieldTypeDescription
idstringParticipant's JID
reasonstringReason for success or failure (e.g., "SUCCESS", "ALREADY_IN_GROUP")

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
403Forbidden - Not authorized to add participants
404Not Found - Session or group not found
429Too many requests - Rate limit exceeded
500Internal server error

Notes

  • Only group admins can add new participants
  • Phone numbers must be in international format
  • You can add multiple participants in a single request
  • The group must not be full (maximum 1024 participants)
  • Some participants may not be added if they have blocked the group or have privacy settings preventing them from being added