Wasend

Get Session Info

Get detailed information about a WhatsApp session

Get Session Info

Get detailed information about a specific WhatsApp session.

Endpoint

GET /sessions/{sessionId}

Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token for authentication

Path Parameters

NameTypeRequiredDescription
sessionIdstringYesUnique identifier of the session

Response

{
  "uniqueSessionId": "string",
  "sessionName": "string",
  "phoneNumber": "string",
  "status": "string",
  "createdAt": "string",
  "updatedAt": "string",
  "config": {
    "enableAccountProtection": boolean,
    "enableMessageLogging": boolean,
    "enableWebhook": boolean,
    "webhookUrl": "string"
  }
}

Example

curl -X GET "https://api.wasend.dev/sessions/SESSION_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
import { WasendClient } from '@wasend/core';

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

// Get session information
const session = await client.retrieveSessionInfo('SESSION_ID');
console.log('Session info:', session);
const { WasendClient } = require('@wasend/core');

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

const session = await client.retrieveSessionInfo('SESSION_ID');
console.log('Session info:', session);
from wasend import WasendClient

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

session = client.retrieve_session_info('SESSION_ID')
print('Session info:', session)
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"),
	})

	session := client.RetrieveSessionInfo(StringPtr("SESSION_ID"))
	fmt.Printf("Session info: %+v\n", session)
}
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);
var session = client.RetrieveSessionInfo("your-session-id-here");
Console.WriteLine($"Session info: {session}");
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.wasend.dev/sessions/SESSION_ID"))
            .header("Authorization", "Bearer YOUR_API_KEY")
            .GET()
            .build();

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

curl_setopt($ch, CURLOPT_URL, "https://api.wasend.dev/sessions/SESSION_ID");
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: " . $response;
require 'net/http'
require 'uri'

uri = URI('https://api.wasend.dev/sessions/SESSION_ID')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts "Response: #{response.body}"
import Foundation

let url = URL(string: "https://api.wasend.dev/sessions/SESSION_ID")!
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 {
        print("Response: \(String(data: data, encoding: .utf8) ?? "")")
    }
}
task.resume()
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};

#[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")?
    );

    let client = reqwest::Client::new();
    let response = client
        .get("https://api.wasend.dev/sessions/SESSION_ID")
        .headers(headers)
        .send()
        .await?
        .text()
        .await?;

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

SDK Integration

The WASend SDKs provide a simple and consistent interface across all supported languages. Here's how to integrate them into your project:

TypeScript/JavaScript

# Using npm
npm install @wasend/core

# Using yarn
yarn add @wasend/core

Python

pip install wasend

.NET

dotnet add package Wasend.Core

Go

go get github.com/wasenddev/wasend-sdk-go

Integration Testing

The SDKs include integration tests that demonstrate proper usage. Here's an example of a typical session info retrieval flow:

  1. Get session information
  2. Check session status
  3. Handle different session states

For detailed integration examples, refer to the SDK documentation and test files in each repository.

Response Fields

FieldTypeDescription
uniqueSessionIdstringUnique identifier for the session
sessionNamestringName of the session
phoneNumberstringPhone number associated with the session
statusstringCurrent status of the session
createdAtstringTimestamp when the session was created
updatedAtstringTimestamp when the session was last updated
configobjectSession configuration settings
config.enableAccountProtectionbooleanWhether account protection is enabled
config.enableMessageLoggingbooleanWhether message logging is enabled
config.enableWebhookbooleanWhether webhook notifications are enabled
config.webhookUrlstringWebhook URL for notifications

Error Codes

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

Notes

  • This endpoint provides real-time session status
  • The status field indicates the current state of the session
  • Session information is updated automatically
  • The SDKs handle error cases and provide appropriate error messages
  • Integration tests demonstrate proper error handling