Get Group Info
Retrieve information about a WhatsApp group
Get Group Info
Retrieve detailed information about a specific WhatsApp group.
Endpoint
GET /{sessionId}/groups/{groupId}/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 |
groupId | string | Yes | The group ID |
Response
{
"success": true,
"info": {
"id": "1234567890@g.us",
"name": "Test Group Name",
"subject": "Test Group Subject",
"description": "This is a test group description.",
"creation": "2023-01-15T10:00:00Z",
"owner": {
"jid": "owner_jid@c.us",
"phoneNumber": "+1234567890"
},
"participants": [
{
"jid": "participant1_jid@c.us",
"phoneNumber": "+1122334455",
"isAdmin": true,
"isSuperAdmin": false
},
{
"jid": "participant2_jid@c.us",
"phoneNumber": "+1667788990",
"isAdmin": false,
"isSuperAdmin": false
}
],
"settings": {
"announce": false,
"restrict": false,
"ephemeral": 0,
"noFrequentlyForwarded": true
}
}
}
Examples
curl -X GET "https://api.wasend.dev/{sessionId}/groups/{groupId}/info" \
-H "Authorization: Bearer YOUR_API_KEY"
import { WasendClient } from '@wasend/core';
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
const sessionId = "yourSessionId";
const groupId = "yourGroupId";
// Get group info
const result = await client.getGroupInfo(sessionId, groupId);
if (result.success) {
console.log('Group info:', result.info);
} else {
console.error('Failed to get group info:', result.error);
}
const { WasendClient } = require('@wasend/core');
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
const sessionId = "yourSessionId";
const groupId = "yourGroupId";
// Get group info
client.getGroupInfo(sessionId, groupId)
.then(result => {
if (result.success) {
console.log('Group info:', result.info);
} else {
console.error('Failed to get group info:', result.error);
}
})
.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"
group_id = "yourGroupId"
# Get group info
result = client.get_group_info(
session_id=session_id,
group_id=group_id
)
if result.success:
print(f"Group info: {result.info}")
else:
print(f"Failed to get group info: {result.error}")
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"
groupId := "yourGroupId"
// Get group info
result, err := client.GetGroupInfo(sessionId, groupId) // Assuming GetGroupInfo exists and returns a struct with Success, Info, Error
if err != nil {
log.Fatalf("Error getting group info: %v", err)
}
if result.Success {
fmt.Printf("Group info: %+v\n", result.Info)
} else {
// Assuming Error is a *string in the Go SDK for this response
if result.Error != nil {
fmt.Printf("Failed to get group info: %s\n", *result.Error)
} else {
fmt.Println("Failed to get group info, no specific error message.")
}
}
}
using Wasend.Core; // Assuming Wasend.Core namespace
using System;
using System.Threading.Tasks;
public class Example
{
public static async Task Main(string[] args) // API.md shows sync, but docs used async. Keeping async for now.
{
var config = new WasendConfig
{
ApiKey = "YOUR_API_KEY"
};
var client = new WasendClient(config);
string sessionId = "yourSessionId";
string groupId = "yourGroupId";
// Get group info
// Assuming GetGroupInfo method exists and returns a response object with Success, Info, and Error properties
var result = client.GetGroupInfo(sessionId, groupId); // If truly async, should be await client.GetGroupInfoAsync(...)
if (result.Success)
{
Console.WriteLine($"Group ID: {result.Info.Id}");
Console.WriteLine($"Group Name: {result.Info.Name}");
// Access other fields from result.Info as needed
}
else
{
Console.WriteLine($"Failed to get group info: {result.Error}");
}
}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient httpClient = HttpClient.newHttpClient();
String sessionId = "yourSessionId";
String groupId = "yourGroupId";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wasend.dev/" + sessionId + "/groups/" + groupId + "/info"))
.header("Authorization", "Bearer YOUR_API_KEY")
.GET()
.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}/info";
$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);
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}/info")
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)
puts "Response: #{response.body}"
import Foundation
let sessionId = "yourSessionId"
let groupId = "yourGroupId"
let url = URL(string: "https://api.wasend.dev/\(sessionId)/groups/\(groupId)/info")!
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) {
print("Response: \(responseString)")
}
}
task.resume()
use reqwest::Client;
use serde_json::Value;
#[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/{}/info", session_id, group_id);
let response_text = client
.get(&url)
.header("Authorization", "Bearer YOUR_API_KEY")
.send()
.await?
.text()
.await?;
println!("Response: {}", response_text);
Ok(())
}
Response Fields
Field | Type | Description |
---|---|---|
success | boolean | Whether the operation was successful |
info | Info Object | The detailed group information |
error | string | Optional. Error message if success is false . |
Info Object
Field | Type | Description |
---|---|---|
id | string | The group ID (e.g., 1234567890@g.us ) |
name | string | The group name |
subject | string | The group subject (often same as name) |
description | string | The group description |
creation | string | ISO 8601 timestamp of group creation |
owner | Owner Object | Information about the group owner |
participants | Participant[] | List of group participants |
settings | Settings Object | Group settings |
Owner Object
Field | Type | Description |
---|---|---|
jid | string | Owner's JID |
phoneNumber | string | Owner's phone number |
Participant Object
Field | Type | Description |
---|---|---|
jid | string | Participant's JID |
phoneNumber | string | Participant's phone number |
isAdmin | boolean | Whether the participant is an admin |
isSuperAdmin | boolean | Whether the participant is a super admin (usually the owner) |
Settings Object
Field | Type | Description |
---|---|---|
announce | boolean | Whether only admins can send messages (announcement mode) |
restrict | boolean | Whether only admins can modify group info (deprecated, use infoAdminOnly from group settings) |
ephemeral | number | Message disappearing time in seconds (0 if disabled) |
noFrequentlyForwarded | boolean | Whether frequently forwarded messages are restricted |
Error Codes
Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Not authorized to get group info |
404 | Not Found - Session or group not found |
429 | Too many requests - Rate limit exceeded |
500 | Internal server error |
Notes
- You must be a member of the group to get its info.
- The response includes all group settings and participants.
- The
creation
timestamp is in ISO 8601 format. - The
owner
is typically the creator and a super admin. - The
settings.restrict
field might be deprecated in favor of more specific settings likeinfoAdminOnly
(see Get Group Info Admin Only Setting) andmessagesAdminOnly
(see Get Group Messages Admin Only Setting).