Get Group Join Info
Retrieve information about a group using an invite code or URL.
Get Group Join Info
Retrieve detailed information about a WhatsApp group by providing its invite code or full invite URL. This is useful for previewing group details before deciding to join.
Endpoint
GET /{sessionId}/groups/join-info
Headers
Name | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Bearer token for authentication |
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
sessionId | string | Yes | The session ID |
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
code | string | Yes | The group invite code or full invite URL. |
Response
{
"success": true,
"data": {
"jid": "120363025988123456@g.us",
"name": "Tech Innovators Collective",
"topic": "Discussing the future of technology and innovation.", // topic is the description
"groupCreated": "2023-05-10T10:00:00Z",
"ownerJid": "919876543210@c.us",
"participantsCount": 25, // This is not directly in API.md Group, but often available.
// If not, it would be derived from the length of participants array.
"isAnnounce": false,
"isLocked": false
// ... other fields from the Group object as defined in API.md
},
"error": null
}
Examples
curl -X GET "https://api.wasend.dev/{sessionId}/groups/join-info?code=YOUR_INVITE_CODE_OR_URL" \
-H "Authorization: Bearer YOUR_API_KEY"
import { WasendClient, Group } from '@wasend/core'; // Group is the response type from API.md
// Assuming the actual API returns {success: boolean, data: Group, error?: string}
interface GetGroupJoinInfoApiResponse {
success: boolean;
data?: Group;
error?: string;
}
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
const sessionId = "yourSessionId";
const inviteCodeOrUrl = "YOUR_INVITE_CODE_OR_URL";
async function run() {
try {
// API.md: client.getGroupJoinInfo(sessionId, code) returns Group
// We assume SDK handles mapping to this structure or directly returns it.
const groupInfo: Group = await client.getGroupJoinInfo(sessionId, inviteCodeOrUrl);
// If the SDK returns the raw API response with {success, data, error}
// const response: GetGroupJoinInfoApiResponse = await client.getGroupJoinInfoRaw(sessionId, inviteCodeOrUrl);
// if (response.success && response.data) { ... }
if (groupInfo) {
console.log('Group Name:', groupInfo.name);
console.log('Group JID:', groupInfo.jid);
console.log('Group Description (Topic):', groupInfo.topic);
} else {
console.error('Failed to get group join info or group not found.');
}
} catch (error) {
console.error('Error:', error);
}
}
run();
const { WasendClient } = require('@wasend/core');
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
const sessionId = "yourSessionId";
const inviteCodeOrUrl = "YOUR_INVITE_CODE_OR_URL";
client.getGroupJoinInfo(sessionId, inviteCodeOrUrl)
.then(groupInfo => {
if (groupInfo) {
console.log('Group Name:', groupInfo.name);
console.log('Group JID:', groupInfo.jid);
} else {
console.error('Failed to get group join info or group not found.');
}
})
.catch(error => {
console.error('Error:', error);
});
from wasend import WasendClient
client = WasendClient(
api_key='YOUR_API_KEY',
base_url='https://api.wasend.dev'
)
session_id = "yourSessionId"
invite_code_or_url = "YOUR_INVITE_CODE_OR_URL"
# API.md: get_group_join_info(session_id, code) returns Group object
group_info = client.get_group_join_info(
session_id=session_id,
code=invite_code_or_url
)
if group_info:
print(f"Group Name: {group_info.name}")
print(f"Group JID: {group_info.jid}")
print(f"Group Description (Topic): {group_info.topic}")
else:
print("Failed to get group join info or group not found.")
package main
import (
"fmt"
"log"
"github.com/wasenddev/wasend-sdk-go/wasendcore"
)
func StringPtr(s string) *string { return &s }
func main() {
client := wasendcore.NewWasendClient(&wasendcore.WasendConfig{
ApiKey: StringPtr("YOUR_API_KEY"),
BaseUrl: StringPtr("https://api.wasend.dev"),
})
sessionId := "yourSessionId"
inviteCodeOrUrl := "YOUR_INVITE_CODE_OR_URL"
// API.md: GetGroupJoinInfo(sessionId string, code string) (*Group, error)
groupInfo, err := client.GetGroupJoinInfo(sessionId, inviteCodeOrUrl)
if err != nil {
log.Fatalf("Error getting group join info: %v", err)
}
if groupInfo != nil {
fmt.Printf("Group Name: %s\n", *groupInfo.Name)
fmt.Printf("Group JID: %s\n", *groupInfo.Jid)
if groupInfo.Topic != nil {
fmt.Printf("Group Description (Topic): %s\n", *groupInfo.Topic)
}
} else {
fmt.Println("Failed to get group join info or group not found.")
}
}
using Wasend.Core; // For WasendClient, WasendConfig, Group
using System;
using System.Threading.Tasks;
public class Example
{
public static async Task Main(string[] args) // API.md method is sync, but .NET SDKs are often async by convention
{
var config = new WasendConfig
{
ApiKey = "YOUR_API_KEY"
// BaseUrl can be set if not using the default
};
var client = new WasendClient(config);
string sessionId = "yourSessionId";
string inviteCodeOrUrl = "YOUR_INVITE_CODE_OR_URL";
// API.md: GetGroupJoinInfo(string sessionId, string code) returns Group
Group groupInfo = client.GetGroupJoinInfo(sessionId, inviteCodeOrUrl);
if (groupInfo != null)
{
Console.WriteLine($"Group Name: {groupInfo.Name}");
Console.WriteLine($"Group JID: {groupInfo.Jid}");
Console.WriteLine($"Group Description (Topic): {groupInfo.Topic}");
}
else
{
Console.WriteLine("Failed to get group join info or group not found.");
}
}
}
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient httpClient = HttpClient.newHttpClient();
String sessionId = "yourSessionId";
String inviteCodeOrUrl = "YOUR_INVITE_CODE_OR_URL";
String encodedCode = URLEncoder.encode(inviteCodeOrUrl, StandardCharsets.UTF_8.toString());
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wasend.dev/" + sessionId + "/groups/join-info?code=" + encodedCode))
.header("Authorization", "Bearer YOUR_API_KEY")
.GET()
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
// Expects a JSON response like: {"success": true, "data": { ...Group fields... }, "error": null}
System.out.println("Response: " + response.body());
}
}
<?php
$sessionId = 'yourSessionId';
$inviteCodeOrUrl = 'YOUR_INVITE_CODE_OR_URL';
$encodedCode = urlencode($inviteCodeOrUrl);
$url = "https://api.wasend.dev/{$sessionId}/groups/join-info?code={$encodedCode}";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY'
]);
$response = curl_exec($ch);
curl_close($ch);
// Expects a JSON response like: {"success": true, "data": { ...Group fields... }, "error": null}
echo $response;
?>
require 'net/http';
require 'uri';
require 'json';
session_id = 'yourSessionId'
invite_code_or_url = 'YOUR_INVITE_CODE_OR_URL'
encoded_code = URI.encode_www_form_component(invite_code_or_url)
uri = URI("https://api.wasend.dev/#{session_id}/groups/join-info?code=#{encoded_code}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true # For HTTPS
request_obj = Net::HTTP::Get.new(uri.request_uri)
request_obj['Authorization'] = 'Bearer YOUR_API_KEY'
response = http.request(request_obj)
# Expects a JSON response like: {"success": true, "data": { ...Group fields... }, "error": null}
puts "Response: #{response.body}"
import Foundation
let sessionId = "yourSessionId"
let inviteCodeOrUrl = "YOUR_INVITE_CODE_OR_URL"
var components = URLComponents(string: "https://api.wasend.dev/\(sessionId)/groups/join-info")!
components.queryItems = [URLQueryItem(name: "code", value: inviteCodeOrUrl)]
let url = components.url!
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.setValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data, let responseString = String(data: data, encoding: .utf8) {
// Expects a JSON response like: {"success": true, "data": { ...Group fields... }, "error": null}
print("Response: \(responseString)")
}
}
task.resume()
use reqwest::Client;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let session_id = "yourSessionId";
let invite_code_or_url = "YOUR_INVITE_CODE_OR_URL";
let url = format!("https://api.wasend.dev/{}/groups/join-info", session_id);
let mut query_params = HashMap::new();
query_params.insert("code", invite_code_or_url);
let response_text = client
.get(&url)
.query(&query_params)
.header("Authorization", "Bearer YOUR_API_KEY")
.send()
.await?
.text()
.await?;
// Expects a JSON response like: {"success": true, "data": { ...Group fields... }, "error": null}
println!("Response: {}", response_text);
Ok(())
}
Response Fields
Field | Type | Description |
---|---|---|
success | boolean | Whether the operation was successful |
data | object | The Group object containing details. Null if error. |
error | string | Optional. Error message if success is false . |
Group Object Fields (Subset from API.md Group)
This endpoint returns a Group
object as defined in API.md
. Key fields include:
Field | Type | Description |
---|---|---|
jid | string | Group JID (e.g., xxxxxxxxxxxxx@g.us ) |
name | string | Group name/subject. |
topic | string | Group description. |
groupCreated | string | ISO 8601 timestamp of group creation. |
ownerJid | string | JID of the group owner/creator. |
participants | array | Array of GroupParticipant objects. |
isAnnounce | boolean | true if only admins can send messages. |
isLocked | boolean | true if only admins can change group info. |
isEphemeral | boolean | true if disappearing messages are enabled. |
disappearingTimer | number | Disappearing message timer in seconds (0 if off). |
... | ... | Other fields as per API.md Group definition. |
Note: The exact list of fields returned might vary or be a subset. Refer to API.md
for the complete Group
object structure. The participantsCount
in the example above might be derived from the participants
array length if not directly provided.
Error Codes
Code | Description |
---|---|
400 | Bad Request - Invalid sessionId or code . |
401 | Unauthorized - Invalid or missing API key. |
403 | Forbidden - Not authorized for this operation. |
404 | Not Found - Session or group (via invite code) not found. |
429 | Too many requests - Rate limit exceeded. |
500 | Internal server error. |
Notes
- This endpoint allows checking group information before joining.
- The
code
parameter can be the short invite code (e.g.,AbCdEfGhIjKlMnOpQrStUv
) or the full invite URL (e.g.,https://chat.whatsapp.com/AbCdEfGhIjKlMnOpQrStUv
). - The returned group information is based on what is publicly available via the invite link and what the session can access.
- If the invite code is invalid or expired, a
404
error is typically returned. - The
topic
field in theGroup
object corresponds to the group's description.