### Set Up Webhooks Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Configure webhooks for a session to receive real-time event notifications from WAHA. ```typescript const { data: updatedSession } = await client.sessions.sessionsControllerUpdate('default', { config: { webhooks: [ { url: 'https://example.com/webhook', events: ['message', 'session.status', 'group.update'], }, ], }, }) console.log('Webhook configured') ``` -------------------------------- ### Create a Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Create a new WhatsApp session with a specified name. The 'start: true' option initiates the session immediately. ```typescript // Create a new WhatsApp session const { data: session } = await client.sessions.sessionsControllerCreate({ name: 'default', start: true, }) console.log(`Session created: ${session.status}`) // Output: Session created: SCAN_QR_CODE ``` -------------------------------- ### Get All Sessions Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Retrieve a list of all active WAHA sessions and their current statuses. ```typescript const { data: sessions } = await client.sessions.sessionsControllerList() sessions.forEach((session) => { console.log(`- ${session.name}: ${session.status}`) }) ``` -------------------------------- ### Wait for Session to be Ready Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Poll the session status until it becomes 'WORKING'. This example polls up to 100 times with a 1-second delay between polls. ```typescript // Poll until session is WORKING let session let attempts = 0 while (attempts < 100) { const { data: currentSession } = await client.sessions.sessionsControllerGet('default') if (currentSession.status === 'WORKING') { session = currentSession break } console.log(`Status: ${currentSession.status}`) await new Promise((resolve) => setTimeout(resolve, 1000)) attempts++ } console.log('Session ready!') ``` -------------------------------- ### Initialize the Client Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Initialize the WahaClient with your WAHA server URL and API key. ```typescript import { WahaClient } from '@muhammedaksam/waha-node' const client = new WahaClient('http://localhost:3000', 'your-api-key') ``` -------------------------------- ### Get Chats Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Retrieve a list of chats for a given session. ```typescript const { data: chats } = await client.chats.chatsControllerList('default') chats.forEach((chat) => { console.log(`- ${chat.name}`) }) ``` -------------------------------- ### GET Request Example (List Sessions) Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Example of a GET request to list sessions, including the endpoint and required headers. ```http GET /api/sessions Authorization: X-Api-Key: your-api-key ``` -------------------------------- ### Get Server Status Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Events.md Example of how to get server status and log its version and session count. ```typescript const { data: status } = await client.events.eventsControllerGetServerStatus() console.log(`Server version: ${status.version}`) console.log(`Sessions: ${status.sessionsCount}`) ``` -------------------------------- ### Add Group Members Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Add new participants to an existing WhatsApp group. ```typescript await client.groups.groupsControllerAddParticipants('default', groupId.id, { participants: [{ id: '5555555555@c.us' }], }) ``` -------------------------------- ### GET Request Response Example (List Sessions) Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Example JSON response for listing sessions. ```json [ { "name": "default", "status": "WORKING", "me": { "id": "1234567890@c.us", "pushName": "Your Name" } } ] ``` -------------------------------- ### Direct HTTP Client Usage Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/HttpClient.md Demonstrates direct usage of HttpClient for GET and POST requests. ```typescript import { HttpClient } from '@muhammedaksam/waha-node' const http = new HttpClient({ baseURL: 'http://localhost:3000', securityWorker: () => ({ headers: { 'X-Api-Key': 'api-key' } }), }) // Make a GET request const { data: sessions } = await http.request({ path: '/api/sessions', method: 'GET', secure: true, }) // Make a POST request const { data: newSession } = await http.request({ path: '/api/sessions', method: 'POST', body: { name: 'new-session', start: true }, type: 'application/json', secure: true, }) ``` -------------------------------- ### Client Initialization Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Example of initializing the WahaClient with custom configuration. ```typescript import { WahaClient } from '@muhammedaksam/waha-node' const client = new WahaClient({ baseURL: 'http://localhost:3000', timeout: 30000, securityWorker: () => ({ headers: { 'X-Api-Key': process.env.WAHA_API_KEY }, }), headers: { 'User-Agent': 'MyBot/1.0', }, }) ``` -------------------------------- ### Create Group Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Create a new WhatsApp group with a specified title and initial participants. ```typescript const { data: groupId } = await client.groups.groupsControllerCreate({ title: 'My Group', participants: [ { id: '1234567890@c.us' }, { id: '9876543210@c.us' }, ], session: 'default', }) console.log(`Group created: ${groupId.id}`) ``` -------------------------------- ### HttpClient Request Method Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/HttpClient.md Example of making a GET request using the request method. ```typescript const { data } = await http.request({ path: '/api/sessions', method: 'GET', secure: true, }) ``` -------------------------------- ### Get Contacts Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Retrieve a list of contacts associated with a specific session. ```typescript const { data: contacts } = await client.contacts.contactsControllerList('default') contacts.forEach((contact) => { console.log(`- ${contact.name} (${contact.id})`) }) ``` -------------------------------- ### Using Modular Imports Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Import and use specific controllers like 'Chatting' and 'HttpClient' for more granular control over your WAHA integration. ```typescript import { Chatting, HttpClient } from '@muhammedaksam/waha-node' const http = new HttpClient({ baseURL: 'http://localhost:3000', securityWorker: () => ({ headers: { 'X-Api-Key': 'your-api-key' } }), }) const chatting = new Chatting(http) const { data: message } = await chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text: 'Hello!', session: 'default', }) ``` -------------------------------- ### HttpClient Constructor Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/HttpClient.md Example of how to instantiate the HttpClient with configuration options. ```typescript import { HttpClient } from '@muhammedaksam/waha-node' const http = new HttpClient({ baseURL: 'http://localhost:3000', timeout: 30000, securityWorker: () => ({ headers: { 'X-Api-Key': 'your-api-key' } }), }) ``` -------------------------------- ### API Key Creation Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Example demonstrating how to create an API key with specific actions enabled for session management. ```typescript const { data: apiKey } = await client.apikeys.apiKeysControllerCreate({ isAdmin: false, session: 'default', isActive: true, actions: { read: true, send: true, control: false, }, }) ``` -------------------------------- ### Session Creation Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Example of creating a new session with custom configuration. ```typescript const { data: session } = await client.sessions.sessionsControllerCreate({ name: 'my-session', start: true, config: { metadata: { userId: '123', environment: 'production', }, proxy: { server: 'proxy.example.com:3128', username: 'proxyuser', password: 'proxypass', }, debug: false, webhooks: [ { url: 'https://example.com/webhook', events: ['message', 'session.status'], }, ], }, }) ``` -------------------------------- ### Client Session Creation Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Example demonstrating how to create a custom WhatsApp client session with specified device and browser names. ```typescript const { data } = await client.sessions.sessionsControllerCreate({ name: 'custom-client', config: { client: { deviceName: 'My Bot Device', browserName: 'MyBot/1.0', }, }, }) ``` -------------------------------- ### Proxy Configuration Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Example of configuring a proxy for a session. ```typescript const { data } = await client.sessions.sessionsControllerCreate({ name: 'proxy-session', config: { proxy: { server: 'localhost:3128', username: 'user', password: 'pass', }, }, }) ``` -------------------------------- ### Configuration Examples Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/00_START_HERE.md Examples demonstrating how to configure webhooks and proxies for sessions. ```typescript // Add webhook await client.sessions.sessionsControllerCreate({ name: 'default', config: { webhooks: [{ url: 'https://example.com/webhook', events: ['message', 'session.status'], hmac: { key: 'secret' }, retries: { attempts: 5 } }] } }) // Add proxy await client.sessions.sessionsControllerCreate({ name: 'default', config: { proxy: { server: 'proxy.example.com:3128', username: 'user', password: 'pass' } } }) ``` -------------------------------- ### Error Handling Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Implement robust error handling for API requests, checking for server responses, network errors, and request setup issues. ```typescript try { const { data: message } = await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text: 'Hello!', session: 'default', }) } catch (error) { if (error.response) { // Server responded with error status console.error(`Error ${error.response.status}:`, error.response.data) } else if (error.request) { // Request made but no response console.error('No response from server:', error.message) } else { // Error in request setup console.error('Request error:', error.message) } } ``` -------------------------------- ### Use Environment Variables Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Best practice: Use environment variables for sensitive information like WAHA server URL and API key. ```typescript const client = new WahaClient( process.env.WAHA_URL || 'http://localhost:3000', process.env.WAHA_API_KEY ) ``` -------------------------------- ### Webhook Configuration Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md An example demonstrating how to set up webhook configuration with specific events, HMAC, retries, and custom headers. ```typescript const { data } = await client.sessions.sessionsControllerCreate({ name: 'webhook-session', config: { webhooks: [ { url: 'https://example.com/webhook', events: ['message', 'session.status', 'group.update'], hmac: { key: 'your-secret-key', }, retries: { attempts: 5, delaySeconds: 2, policy: 'exponential', }, customHeaders: [ { name: 'Authorization', value: 'Bearer token123', }, ], }, ], }, }) ``` -------------------------------- ### Send Your First Message Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Send a text message to a specified chat ID using the initialized session. ```typescript const { data: message } = await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', // Replace with actual phone number text: 'Hello from WAHA!', session: 'default', }) console.log(`Message sent: ${message.id}`) ``` -------------------------------- ### Environment Variable Setup Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Recommended environment setup for Waha Node, exporting WAHA_URL and WAHA_API_KEY. ```bash # Recommended environment setup export WAHA_URL=http://localhost:3000 export WAHA_API_KEY=your-api-key-here ``` -------------------------------- ### Ping Server Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Events.md Example of how to ping the server and log a confirmation message. ```typescript const { data: response } = await client.events.eventsControllerPing() console.log('Server is alive') ``` -------------------------------- ### Batch Operations with Delays Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md This code snippet demonstrates how to send multiple messages in a batch with a delay between each message. ```typescript const messages = [ 'Hello 👋', 'How are you? 😊', 'Great to see you!', ] for (const text of messages) { await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text, session: 'default', }) await new Promise((resolve) => setTimeout(resolve, 1000)) // 1 second delay } ``` -------------------------------- ### Add Interceptors for Logging Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md This code snippet shows how to add request and response interceptors to the HTTP client for logging purposes. ```typescript client.httpClient?.interceptors.request.use((config) => { console.log(`${config.method?.toUpperCase()} ${config.url}`) return config }) client.httpClient?.interceptors.response.use( (response) => { console.log(`Response: ${response.status}`) return response }, (error) => { console.error(`Error: ${error.message}`) return Promise.reject(error) } ) ``` -------------------------------- ### Ignore Configuration Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md An example demonstrating how to configure ignoring specific event types like status and broadcast. ```typescript const { data } = await client.sessions.sessionsControllerCreate({ name: 'filtered-session', config: { ignore: { status: true, broadcast: true, }, }, }) ``` -------------------------------- ### Send File Message Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Example of sending a file message. ```typescript const { data } = await client.chatting.chattingControllerSendFile({ chatId: '1234567890@c.us', file: { mimetype: 'application/pdf', filename: 'document.pdf', url: 'https://example.com/document.pdf', }, session: 'default', }) ``` -------------------------------- ### Installation Source: https://github.com/muhammedaksam/waha-node/blob/main/README.md Install the waha-node package using npm, pnpm, or yarn. ```bash npm install @muhammedaksam/waha-node # or pnpm add @muhammedaksam/waha-node # or yarn add @muhammedaksam/waha-node ``` -------------------------------- ### Scan QR Code Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Retrieve the QR code value to scan with your WhatsApp application when the session status is SCAN_QR_CODE. ```typescript const { data: qr } = await client.auth.authControllerGetQr('default') console.log(qr.value) // QR code value ``` -------------------------------- ### Group Management Examples Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/00_START_HERE.md Examples for managing groups, including creating a group, adding/removing members, promoting participants, and setting a description. ```typescript // Create await client.groups.groupsControllerCreate({ title, participants, session }) // Add members await client.groups.groupsControllerAddParticipants( session, groupId, { participants } ) // Remove members await client.groups.groupsControllerRemoveParticipants( session, groupId, { participants } ) // Promote to admin await client.groups.groupsControllerPromoteParticipants( session, groupId, { participants } ) // Set description await client.groups.groupsControllerSetDescription( session, groupId, { description } ) ``` -------------------------------- ### Get a contact's vCard Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Contacts.md This example shows how to retrieve the vCard data for a specific contact using their ID. ```typescript const { data: vcard } = await client.contacts.contactsControllerGetVCard('default', '1234567890@c.us') console.log(`vCard: ${vcard.data}`) ``` -------------------------------- ### Send Text Message Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Example of sending a text message. ```typescript const { data: message } = await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text: 'Hello from WAHA!', session: 'default', }) console.log(`Message sent: ${message.id}`) ``` -------------------------------- ### Handle Rate Limiting Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Implement a delay mechanism to gracefully handle rate limiting errors (HTTP status 429) by waiting before retrying the request. ```typescript const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)) try { await client.chatting.chattingControllerSendText(...) } catch (error) { if (error.response?.status === 429) { console.log('Rate limited, waiting...') await delay(5000) } } ``` -------------------------------- ### HttpClient SetSecurityData Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/HttpClient.md Example of setting security data for the client. ```typescript http.setSecurityData(null) ``` -------------------------------- ### Example Usage of chattingControllerReaction Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Example of how to use the chattingControllerReaction function to send a reaction. ```typescript const { data } = await client.chatting.chattingControllerReaction({ chatId: '1234567890@c.us', messageId: 'message_id_here', emoji: '👍', session: 'default', }) ``` -------------------------------- ### Get chat picture/profile photo Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chats.md Example of how to retrieve a chat's profile picture URL and log it. ```typescript const { data: response } = await client.chats.chatsControllerGetPicture('default', '1234567890-1234567890@g.us') console.log(`Picture URL: ${response.picUrl}`) ``` -------------------------------- ### Send Voice Message Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Example of sending a voice message. ```typescript const { data } = await client.chatting.chattingControllerSendVoice({ chatId: '1234567890@c.us', file: { mimetype: 'audio/ogg', url: 'https://example.com/voice.ogg', }, session: 'default', }) ``` -------------------------------- ### Message Sending Examples Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/00_START_HERE.md Examples of sending different types of messages (text, image, file, voice, video) using the Waha Node.js SDK. ```typescript // Text await client.chatting.chattingControllerSendText({ chatId, text, session }) // Image await client.chatting.chattingControllerSendImage({ chatId, file, caption, session }) // File await client.chatting.chattingControllerSendFile({ chatId, file, caption, session }) // Voice await client.chatting.chattingControllerSendVoice({ chatId, file, session }) // Video await client.chatting.chattingControllerSendVideo({ chatId, file, caption, session }) ``` -------------------------------- ### Start Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md Start a stopped session. ```http POST /api/sessions/{session}/start ``` -------------------------------- ### Send Image Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md Send an image message to a chat, including a caption. The image can be provided via URL or file upload. ```typescript const { data } = await client.chatting.chattingControllerSendImage({ chatId: '1234567890@c.us', file: { mimetype: 'image/jpeg', url: 'https://example.com/image.jpg', }, caption: 'Check this out!', session: 'default', }) ``` -------------------------------- ### Send Image Message Example (URL) Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Example of sending an image message from a URL. ```typescript // From URL const { data } = await client.chatting.chattingControllerSendImage({ chatId: '1234567890@c.us', file: { mimetype: 'image/jpeg', url: 'https://example.com/image.jpg', }, caption: 'Check this image!', session: 'default', }) ``` -------------------------------- ### HttpClient With Interceptors Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/HttpClient.md Example of adding request and response interceptors to the HttpClient instance. ```typescript const http = new HttpClient({ baseURL: 'http://localhost:3000', }) // Add request interceptor http.instance.interceptors.request.use((config) => { console.log('Making request to:', config.url) return config }) // Add response interceptor http.instance.interceptors.response.use( (response) => { console.log('Response:', response.status) return response }, (error) => { console.error('Request failed:', error.message) return Promise.reject(error) } ) ``` -------------------------------- ### Send Image Message Example (Base64) Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Example of sending an image message from base64 data. ```typescript // From base64 const { data } = await client.chatting.chattingControllerSendImage({ chatId: '1234567890@c.us', file: { mimetype: 'image/jpeg', filename: 'photo.jpg', data: '/9j/4AAQSkZJRg...', // base64 data }, session: 'default', }) ``` -------------------------------- ### Get messages from a chat Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chats.md Example of how to retrieve messages from a chat with a specified limit and log the number of retrieved messages. ```typescript const { data: response } = await client.chats.chatsControllerGetMessages('default', '1234567890@c.us', { limit: 50, }) console.log(`Retrieved ${response.messages?.length} messages`) ``` -------------------------------- ### Get Me Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md Get authenticated user information. ```http GET /api/sessions/{session}/me ``` -------------------------------- ### Modular Clients Usage Source: https://github.com/muhammedaksam/waha-node/blob/main/README.md Example of importing and using individual controllers for a tree-shakable approach. ```typescript import { Chatting, HttpClient } from '@muhammedaksam/waha-node' const http = new HttpClient({ baseUrl: 'http://localhost:3000', securityWorker: () => ({ headers: { 'X-Api-Key': 'your-api-key' } }), }) const chatting = new Chatting(http) await chatting.chattingControllerSendText(...) ``` -------------------------------- ### Error Handling Example Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Shows how to handle errors using try-catch blocks for SDK methods, which return promises that reject on error. ```typescript try { const { data } = await client.chatting.chattingControllerSendText(...) } catch (error) { if (error.response?.status === 404) { console.error('Chat not found') } else if (error.request) { console.error('No response from server') } else { console.error('Request error:', error.message) } } ``` -------------------------------- ### Basic Usage Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/WahaClient.md Demonstrates basic usage of the WahaClient for common operations like getting sessions, creating sessions, and sending messages. ```typescript import { WahaClient } from '@muhammedaksam/waha-node' const client = new WahaClient('http://localhost:3000', 'api-key') // Get all sessions const { data: sessions } = await client.sessions.sessionsControllerList() // Create a new session const { data: newSession } = await client.sessions.sessionsControllerCreate({ name: 'my-session', start: true, }) // Send a text message const { data: message } = await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text: 'Hello from WAHA!', session: 'default', }) ``` -------------------------------- ### Create a Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/00_START_HERE.md Creates and starts a new WhatsApp session. ```typescript const { data } = await client.sessions.sessionsControllerCreate({ name: 'default', start: true, }) ``` -------------------------------- ### WahaClient Constructor with config Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/WahaClient.md Initializes the WahaClient with an advanced configuration object for custom HTTP client setup. ```typescript constructor(config: ApiConfig) ``` ```typescript const client = new WahaClient({ baseURL: 'http://localhost:3000', securityWorker: () => ({ headers: { 'X-Api-Key': 'your-api-key' } }), timeout: 30000, }) ``` -------------------------------- ### Validate Phone Numbers Before Sending Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/quick-start.md This code snippet demonstrates how to check if a phone number exists on WhatsApp before sending a message. ```typescript const { data: result } = await client.contacts.contactsControllerCheckExist('default', { phoneNumber: '1234567890', }) if (result.doesExist) { // Send message to valid number } else { console.log('Number not on WhatsApp') } ``` -------------------------------- ### Create Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Sessions.md Creates a new session and optionally starts it. ```typescript sessionsControllerCreate( data: SessionCreateRequest, params?: RequestParams ): Promise> ``` ```typescript const { data: newSession } = await client.sessions.sessionsControllerCreate({ name: 'my-session', start: true, config: { webhooks: [ { url: 'https://example.com/webhook', events: ['message', 'session.status'], }, ], }, }) console.log(`Session created: ${newSession.name}, Status: ${newSession.status}`) ``` -------------------------------- ### Get Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Sessions.md Gets detailed information about a specific session. ```typescript sessionsControllerGet( session: string, query?: { expand?: 'apps'[] }, params?: RequestParams ): Promise> ``` ```typescript const { data: session } = await client.sessions.sessionsControllerGet('default', { expand: ['apps'], }) console.log(`Status: ${session.status}`) console.log(`Me: ${session.me?.id}`) ``` -------------------------------- ### sessionsControllerStart Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Sessions.md Start a stopped session. Idempotent operation. ```typescript sessionsControllerStart( session: string, params?: RequestParams ): Promise> ``` ```typescript const { data: session } = await client.sessions.sessionsControllerStart('default') console.log(`Session started: ${session.status}`) ``` -------------------------------- ### Type Safety Examples Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Demonstrates how the SDK provides type safety for requests and responses, including compile-time errors for incorrect parameters. ```typescript // Request types import type { MessageTextRequest, SessionCreateRequest, CreateGroupRequest, } from '@muhammedaksam/waha-node' // Response types import type { WAMessage, SessionInfo, GroupInfo, Contact, } from '@muhammedaksam/waha-node' // Compile-time errors for incorrect parameters const { data: message } = await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text: 'Hello', // chatId: 123, // ❌ TypeScript error: number not assignable to string }) ``` -------------------------------- ### Authentication Method 1: Simple Token Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Example of authenticating with the SDK using a simple API token. ```typescript const client = new WahaClient('http://localhost:3000', 'api-key') ``` -------------------------------- ### observabilityControllerGetMetrics Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Get server metrics. ```typescript observabilityControllerGetMetrics( params?: RequestParams ): Promise> ``` -------------------------------- ### Type Imports Source: https://github.com/muhammedaksam/waha-node/blob/main/README.md Example of importing various types generated from the WAHA OpenAPI specification. ```typescript import { SessionInfo, MessageTextRequest, WAMessage, QRCodeValue, // ... and many more } from '@muhammedaksam/waha-node' ``` -------------------------------- ### profileControllerGetMe Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Profile.md Get authenticated user's profile information. ```typescript profileControllerGetMe( session?: string, params?: RequestParams ): Promise> ``` ```typescript const { data: profile } = await client.profile.profileControllerGetMe('default') console.log(`Name: ${profile.name}`) console.log(`ID: ${profile.id}`) console.log(`Picture: ${profile.picture}`) ``` -------------------------------- ### Handle Errors Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/00_START_HERE.md Basic error handling example, checking for a 404 status code. ```typescript try { // your code } catch (error) { if (error.response?.status === 404) { console.error('Chat not found') } } ``` -------------------------------- ### Complete Client Usage Source: https://github.com/muhammedaksam/waha-node/blob/main/README.md Example of initializing and using the WahaClient to interact with WAHA API endpoints for sessions, chatting, and authentication. ```typescript import { WahaClient } from '@muhammedaksam/waha-node' // Initialize with baseURL and optional API key const client = new WahaClient('http://localhost:3000', 'your-api-key') // Access controllers via properties // Sessions const { data: sessions } = await client.sessions.sessionsControllerList() // Chatting const { data: message } = await client.chatting.chattingControllerSendText('default', { chatId: '1234567890@c.us', text: 'Hello from waha-node!', session: 'default', }) // Auth const { data: qr } = await client.auth.authControllerGetQr('default', { format: 'raw', }) ``` -------------------------------- ### Generate Types Locally Source: https://github.com/muhammedaksam/waha-node/blob/main/README.md Steps to generate types locally, including starting the WAHA Docker container, retrieving credentials, and running the generation script. ```bash # Start WAHA (credentials will be auto-generated in logs) docker run -d -p 3000:3000 --name waha devlikeapro/waha:latest # Get the generated password from logs docker logs waha 2>&1 | grep WHATSAPP_SWAGGER_PASSWORD # Set credentials and generate export SWAGGER_USER=admin export SWAGGER_PASSWORD= pnpm run generate # Build pnpm run build ``` -------------------------------- ### List all chats in a session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chats.md Example of how to list all chats in a session and log their names and IDs. ```typescript const { data: chats } = await client.chats.chatsControllerList('default') chats.forEach((chat) => { console.log(`${chat.name} (${chat.id})`) }) ``` -------------------------------- ### Error Handling Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/WahaClient.md Provides an example of how to handle errors when making requests with the WahaClient. ```typescript try { const { data } = await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text: 'Message', session: 'default', }) } catch (error) { if (error.response) { console.error('Error status:', error.response.status) console.error('Error data:', error.response.data) } else { console.error('Error:', error.message) } } ``` -------------------------------- ### Get My Profile Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md Retrieves the authenticated user's profile information. ```http GET /api/profile/me ``` -------------------------------- ### sessionsControllerGetMe Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Sessions.md Get authenticated user information for a session. ```typescript sessionsControllerGetMe( session: string, params?: RequestParams ): Promise> ``` ```typescript const { data: me } = await client.sessions.sessionsControllerGetMe('default') console.log(`Authenticated as: ${me.pushName} (${me.id})`) ``` -------------------------------- ### Authentication Method 2: Custom Security Worker Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Example of authenticating with the SDK using a custom security worker for more advanced header management. ```typescript const client = new WahaClient({ baseURL: 'http://localhost:3000', securityWorker: () => ({ headers: { 'Authorization': 'Bearer token' } }) }) ``` -------------------------------- ### Archive a chat Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chats.md Example of how to archive a chat by setting the 'archive' property to true and log a confirmation message. ```typescript await client.chats.chatsControllerArchive('default', '1234567890@c.us', { archive: true, }) console.log('Chat archived') ``` -------------------------------- ### Send a contact's vCard to a chat Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Contacts.md This example demonstrates how to send a contact's vCard to a specified chat using their contact ID. ```typescript const { data } = await client.contacts.contactsControllerSendVCard({ chatId: '1234567890@c.us', contactId: '9876543210@c.us', session: 'default', }) console.log('vCard sent') ``` -------------------------------- ### Get details of a specific chat Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chats.md Example of how to retrieve and log details of a specific chat, including its name and message count. ```typescript const { data: chat } = await client.chats.chatsControllerGet('default', '1234567890@c.us') console.log(`Chat: ${chat.name}, Messages: ${chat.messages?.length}`) ``` -------------------------------- ### Set Up Webhooks Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Configures webhooks for session events. ```typescript await client.sessions.sessionsControllerUpdate('default', { config: { webhooks: [{ url: 'https://example.com/webhook', events: ['message', 'session.status'], }] } }) ``` -------------------------------- ### Get Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md Get details of a specific session. ```http GET /api/sessions/{session} ``` -------------------------------- ### Initialize the Client Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/00_START_HERE.md Initializes the WahaClient with a server URL and API key. ```typescript import { WahaClient } from '@muhammedaksam/waha-node' const client = new WahaClient('http://localhost:3000', 'api-key') ``` -------------------------------- ### NowebStoreConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the configuration for the Noweb local store, specifying whether it's enabled and if a full sync is required on initialization. ```typescript interface NowebStoreConfig { enabled: boolean fullSync: boolean } ``` -------------------------------- ### Get Group Endpoint Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md API endpoint to get group information. ```http GET /api/groups/{id} ``` -------------------------------- ### Get Contact Endpoint Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md API endpoint to get details of a specific contact. ```http GET /api/contacts/{id} ``` -------------------------------- ### ApiConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Complete configuration object for initializing the HTTP client. ```typescript interface ApiConfig extends Omit< AxiosRequestConfig, 'data' | 'cancelToken' > { baseURL?: string timeout?: number securityWorker?: ( securityData: SecurityDataType | null, ) => Promise | AxiosRequestConfig | void secure?: boolean format?: ResponseType headers?: AxiosRequestHeaders } ``` -------------------------------- ### appsControllerCreate Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Create or enable an app. ```typescript appsControllerCreate( data: App, params?: RequestParams ): Promise> ``` -------------------------------- ### WahaClient Constructor with baseUrl and token Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/WahaClient.md Initializes the WahaClient with a base URL and an optional API key for authentication. ```typescript constructor(baseUrl: string, token?: string) ``` ```typescript import { WahaClient } from '@muhammedaksam/waha-node' // Initialize with baseURL only const client = new WahaClient('http://localhost:3000') // Initialize with baseURL and API key const client = new WahaClient('http://localhost:3000', 'your-api-key') // Access controllers const sessions = await client.sessions.sessionsControllerList() const message = await client.chatting.chattingControllerSendText({ chatId: '1234567890@c.us', text: 'Hello!', session: 'default', }) ``` -------------------------------- ### Create Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md Create a new WhatsApp session. ```http POST /api/sessions ``` -------------------------------- ### NowebConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the configuration for the Noweb engine, including options to mark the session as online and configure local storage. ```typescript interface NowebConfig { markOnline?: boolean store?: NowebStoreConfig } ``` -------------------------------- ### Create a Group Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Creates a new WhatsApp group. ```typescript const { data } = await client.groups.groupsControllerCreate({ title: 'My Group', participants: [{ id: '1234567890@c.us' }], session: 'default', }) ``` -------------------------------- ### Create a Session Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/README.md Creates a new WAHA session. ```typescript const client = new WahaClient('http://localhost:3000', 'api-key') const { data } = await client.sessions.sessionsControllerCreate({ name: 'my-session', start: true, }) ``` -------------------------------- ### Get Session Status Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/00_START_HERE.md Retrieves the current status of a session. ```typescript const { data } = await client.sessions.sessionsControllerGet('default') console.log(data.status) // WORKING, STOPPED, etc. ``` -------------------------------- ### Get Group Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Groups.md Retrieves detailed information about a specific group using its ID and session. ```typescript groupsControllerGet( session: string, id: string, params?: RequestParams ): Promise> ``` ```typescript const { data: group } = await client.groups.groupsControllerGet('default', '1234567890-1234567890@g.us') console.log(`Group: ${group.subject}, Members: ${group.participants?.length}`) ``` -------------------------------- ### ClientSessionConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the configuration for the WhatsApp client's appearance, such as device and browser names. ```typescript interface ClientSessionConfig { deviceName?: string browserName?: string } ``` -------------------------------- ### Delete a chat Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chats.md Example of how to delete a chat and log a confirmation message. ```typescript await client.chats.chatsControllerDelete('default', '1234567890@c.us') console.log('Chat deleted') ``` -------------------------------- ### Request Configuration Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/WahaClient.md Shows how to pass advanced Axios configuration options to controller methods. ```typescript const { data: message } = await client.chatting.chattingControllerSendText( { chatId: '1234567890@c.us', text: 'Hello!', session: 'default', }, { timeout: 10000, headers: { 'Custom-Header': 'value' }, } ) ``` -------------------------------- ### Get a specific contact by ID Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Contacts.md Retrieves the details of a specific contact using its ID and session name. ```typescript contactsControllerGet( session: string, id: string, params?: RequestParams ): Promise> ``` ```typescript const { data: contact } = await client.contacts.contactsControllerGet('default', '1234567890@c.us') console.log(`Contact: ${contact.name}`) ``` -------------------------------- ### Class Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Represents the Chatting controller, extending HttpClient. ```typescript export class Chatting extends HttpClient ``` -------------------------------- ### SessionConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Complete session configuration options. ```typescript interface SessionConfig { metadata?: object proxy?: ProxyConfig debug?: boolean ignore?: IgnoreConfig client?: ClientSessionConfig noweb?: NowebConfig gows?: GowsConfig webjs?: WebjsConfig webhooks?: WebhookConfig[] } ``` -------------------------------- ### Check if a contact exists on WhatsApp Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Contacts.md This example demonstrates how to check if a contact exists on WhatsApp using their phone number. ```typescript const { data: result } = await client.contacts.contactsControllerCheckExist('default', { phoneNumber: '1234567890', }) if (result.doesExist) { console.log('Contact exists on WhatsApp') } else { console.log('Contact does not exist on WhatsApp') } ``` -------------------------------- ### appsControllerList Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md List all apps for a session. ```typescript appsControllerList( session?: string, params?: RequestParams ): Promise> ``` -------------------------------- ### ProxyConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md HTTP proxy configuration. ```typescript interface ProxyConfig { server: string username?: string password?: string } ``` -------------------------------- ### API Methods Access Source: https://github.com/muhammedaksam/waha-node/blob/main/README.md Illustrates how to access different controllers (Sessions, Chatting, Contacts, etc.) through the client properties. ```typescript client.sessions.* // SessionsController client.chatting.* // ChattingController client.contacts.* // ContactsController client.groups.* // GroupsController client.auth.* // AuthController // ...etc ``` -------------------------------- ### Create Group Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Groups.md Creates a new WhatsApp group with specified title, participants, and optional description and session. ```typescript groupsControllerCreate( data: CreateGroupRequest, params?: RequestParams ): Promise> ``` ```typescript const { data: groupId } = await client.groups.groupsControllerCreate({ title: 'My Group', participants: [ { id: '1234567890@c.us' }, { id: '9876543210@c.us' }, ], description: 'A great group', session: 'default', }) console.log(`Group created: ${groupId.id}`) ``` -------------------------------- ### apiKeysControllerList Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Lists all API keys. ```typescript apiKeysControllerList( session?: string, params?: RequestParams ): Promise> ``` -------------------------------- ### labelsControllerCreate Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Creates a new label. ```typescript labelsControllerCreate( data: LabelBody, params?: RequestParams ): Promise> ``` -------------------------------- ### apiKeysControllerCreate Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Creates a new API key. ```typescript apiKeysControllerCreate( data: ApiKeyRequest, params?: RequestParams ): Promise> ``` -------------------------------- ### channelsControllerList Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Lists all channels. ```typescript channelsControllerList( session?: string, params?: RequestParams ): Promise> ``` -------------------------------- ### statusControllerCreate Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Create a status update. ```typescript statusControllerCreate( data: TextStatus | ImageStatus | VoiceStatus | VideoStatus, params?: RequestParams ): Promise> ``` -------------------------------- ### WAMedia Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md WhatsApp media information. ```typescript interface WAMedia { url: string mimetype: string fileLength?: number filename?: string mediaKey?: string } ``` -------------------------------- ### channelsControllerCreate Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Creates a new channel. ```typescript channelsControllerCreate( data: CreateChannelRequest, params?: RequestParams ): Promise> ``` -------------------------------- ### BinaryFile Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md File data as base64 string. ```typescript interface BinaryFile { mimetype: string filename?: string data: string } ``` -------------------------------- ### List Sessions Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/endpoints.md List all WhatsApp sessions. ```http GET /api/sessions ``` -------------------------------- ### GowsStorageConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the configuration for Gows storage, allowing specific types of data like messages, groups, chats, and labels to be stored locally. ```typescript interface GowsStorageConfig { messages?: boolean | null groups?: boolean | null chats?: boolean | null labels?: boolean | null } ``` -------------------------------- ### mediaControllerUpload Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Uploads media to be used in messages. ```typescript mediaControllerUpload( data: FormData, params?: RequestParams ): Promise> ``` -------------------------------- ### WebhookConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the structure for webhook configuration, including URL, events, HMAC signing, retries, and custom headers. ```typescript interface WebhookConfig { url: string events: object[] hmac?: HmacConfiguration retries?: RetriesConfiguration customHeaders?: CustomHeader[] } ``` -------------------------------- ### Pairing Controller Class Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Represents the Pairing controller for managing device pairing. ```typescript export class Pairing extends HttpClient ``` -------------------------------- ### Profile Class Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Profile.md Represents the Profile controller class, extending HttpClient. ```typescript export class Profile extends HttpClient ``` -------------------------------- ### App Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md Integrated app configuration. ```typescript interface App { enabled?: boolean id: string session: string app: 'chatwoot' | 'calls' | 'mcp' config: object } ``` -------------------------------- ### CreateChannelRequest Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md Request to create a channel. ```typescript interface CreateChannelRequest { name: string description?: string session?: string } ``` -------------------------------- ### labelsControllerList Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Lists all labels. ```typescript labelsControllerList( session?: string, params?: RequestParams ): Promise> ``` -------------------------------- ### presenceControllerList Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Lists presence information. ```typescript presenceControllerList( session: string, id: string, params?: RequestParams ): Promise> ``` -------------------------------- ### S3MediaData Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md S3 media reference. ```typescript interface S3MediaData { bucket: string key: string } ``` -------------------------------- ### Media Controller Class Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Controllers.md Represents the Media controller for managing media files and uploads. ```typescript export class Media extends HttpClient ``` -------------------------------- ### GowsConfig Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the configuration for the Gows engine, primarily related to storage settings. ```typescript interface GowsConfig { storage?: GowsStorageConfig } ``` -------------------------------- ### RetriesConfiguration Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the structure for webhook delivery retry policies, including delay, attempts, and backoff policy. ```typescript interface RetriesConfiguration { delaySeconds?: number attempts?: number policy?: 'linear' | 'exponential' | 'constant' } ``` -------------------------------- ### ApiKeyRequest Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md Request to create an API key. ```typescript interface ApiKeyRequest { isAdmin: boolean session: string | null isActive: boolean actions?: SessionActionsDTO | null } ``` -------------------------------- ### chattingControllerSendLinkCustomPreview Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Send a text message with a custom link preview (instead of auto-generated). ```typescript chattingControllerSendLinkCustomPreview( data: MessageLinkCustomPreviewRequest, params?: RequestParams ): Promise> ``` ```typescript const { data } = await client.chatting.chattingControllerSendLinkCustomPreview({ chatId: '1234567890@c.us', text: 'Check this out:', url: 'https://example.com', title: 'Example Website', description: 'A great example', session: 'default', }) ``` -------------------------------- ### SessionActionsDTO Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/configuration.md Defines the permission scopes for an API key, specifying read, send, control, setting, app, and delete permissions. ```typescript interface SessionActionsDTO { read?: boolean send?: boolean control?: boolean setting?: boolean app?: boolean delete?: boolean } ``` -------------------------------- ### chattingControllerSendVideo Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Chatting.md Send a video message. Supports URL or base64 data. ```typescript chattingControllerSendVideo( data: MessageVideoRequest, params?: RequestParams ): Promise> ``` ```typescript const { data } = await client.chatting.chattingControllerSendVideo({ chatId: '1234567890@c.us', file: { mimetype: 'video/mp4', url: 'https://example.com/video.mp4', }, caption: 'Check this video!', session: 'default', }) ``` -------------------------------- ### Base64File Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md Base64 encoded file. ```typescript interface Base64File { mimetype: string data: string } ``` -------------------------------- ### SessionInfo Interface Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/types.md Complete session information including status and configuration. ```typescript interface SessionInfo { name: string apps?: App[] | null me?: MeInfo assignedWorker?: string presence: object timestamps: { activity: number | null } status: 'STOPPED' | 'STARTING' | 'SCAN_QR_CODE' | 'WORKING' | 'FAILED' config?: SessionConfig } ``` -------------------------------- ### eventsControllerPing Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Events.md Pings the server to check connectivity. ```typescript eventsControllerPing( params?: RequestParams ): Promise> ``` -------------------------------- ### eventsControllerGetServerStatus Method Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/Events.md Retrieves the server status and information. ```typescript eventsControllerGetServerStatus( params?: RequestParams ): Promise> ``` -------------------------------- ### httpClient Property Source: https://github.com/muhammedaksam/waha-node/blob/main/_autodocs/WahaClient.md Returns the underlying Axios instance used by all controllers. Useful for adding custom interceptors. ```typescript public get httpClient(): AxiosInstance | undefined ``` ```typescript const client = new WahaClient('http://localhost:3000', 'api-key') // Add request interceptor client.httpClient?.interceptors.request.use((config) => { console.log('Request:', config.method, config.url) return config }) // Add response interceptor client.httpClient?.interceptors.response.use((response) => { console.log('Response:', response.status, response.config.url) return response }) // Add error interceptor client.httpClient?.interceptors.response.use( (response) => response, (error) => { console.error('Error:', error.message) return Promise.reject(error) } ) ```