Get Group Invite Link
Retrieve the invite link for a WhatsApp group
Get Group Invite Link
Retrieve the invite link for a WhatsApp group.
Endpoint
GET /{sessionId}/groups/{groupId}/invite-link
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,
"inviteLink": "string",
"expiresAt": "string"
}
Examples
import { WasendClient } from '@wasend/core';
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
// Get group invite link
const result = await client.getGroupInviteLink(sessionId, groupId);
console.log('Invite link:', result.inviteLink);
console.log('Expires at:', result.expiresAt);
const { WasendClient } = require('@wasend/core');
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
// Get group invite link
const result = await client.getGroupInviteLink(sessionId, groupId);
from wasend import WasendClient
client = WasendClient(
api_key='YOUR_API_KEY',
base_url='https://api.wasend.dev'
)
# Get group invite link
result = client.get_group_invite_link(
session_id=sessionId,
group_id=groupId
)
package main
import (
"context"
"fmt"
"log"
"github.com/wasenddev/wasend-sdk-go"
)
func main() {
client := wasend.NewClient("YOUR_API_KEY", "https://api.wasend.dev")
// Get group invite link
result, err := client.GetGroupInviteLink(context.Background(), sessionId, groupId)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Invite link: %s\n", result.InviteLink)
fmt.Printf("Expires at: %s\n", result.ExpiresAt)
}
using Wasend.SDK;
var client = new WasendClient("YOUR_API_KEY", "https://api.wasend.dev");
// Get group invite link
var result = await client.GetGroupInviteLinkAsync(sessionId, groupId);
import com.wasend.sdk.WasendClient;
public class Main {
public static void main(String[] args) {
WasendClient client = new WasendClient("YOUR_API_KEY", "https://api.wasend.dev");
var result = client.getGroupInviteLink(sessionId, groupId);
}
}
<?php
use Wasend\SDK\WasendClient;
$client = new WasendClient([
'api_key' => 'YOUR_API_KEY',
'base_url' => 'https://api.wasend.dev'
]);
// Get group invite link
$result = $client->getGroupInviteLink($sessionId, $groupId);
require 'wasend-sdk'
client = Wasend::Client.new(
api_key: 'YOUR_API_KEY',
base_url: 'https://api.wasend.dev'
)
# Get group invite link
result = client.get_group_invite_link(
session_id: sessionId,
group_id: groupId
)
import WasendSDK
let client = WasendClient(apiKey: "YOUR_API_KEY", baseURL: "https://api.wasend.dev")
// Get group invite link
let result = try await client.getGroupInviteLink(
sessionId: sessionId,
groupId: groupId
)
use wasend_sdk::WasendClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = WasendClient::new("YOUR_API_KEY", "https://api.wasend.dev");
// Get group invite link
let result = client.get_group_invite_link(
sessionId,
groupId
).await?;
println!("Invite link: {:?}", result.invite_link);
println!("Expires at: {:?}", result.expires_at);
Ok(())
}
curl -X GET "https://api.wasend.dev/{sessionId}/groups/{groupId}/invite-link" \
-H "Authorization: Bearer YOUR_API_KEY"
Response Fields
Field | Type | Description |
---|---|---|
success | boolean | Whether the operation was successful |
inviteLink | string | The group invite link |
expiresAt | string | When the invite link expires |
Error Codes
Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Not authorized to get invite link |
404 | Not Found - Session or group not found |
429 | Too many requests - Rate limit exceeded |
500 | Internal server error |
Notes
- You must be an admin of the group to get its invite link
- The invite link expires after 7 days
- The invite link can be used by anyone to join the group
- The invite link is unique to the group
- The invite link can be revoked by admins
- The invite link is part of the group's public information
- The expiresAt timestamp is in ISO 8601 format