getFullUrl

View as MarkdownOpen in Claude

Get the full URL for this agent’s endpoint. The URL is constructed from the agent’s host, port, and route. When behind a proxy, the SWML_PROXY_URL_BASE environment variable or manualSetProxyUrl() takes precedence.

Parameters

includeAuth
booleanDefaults to false

Whether to embed Basic Auth credentials in the URL (e.g., https://user:pass@host:port/route).

Returns

string — The fully constructed URL string.

Example

1import { AgentBase } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'support', route: '/support', port: 3000 });
4agent.setPromptText('You are a helpful assistant.');
5
6const url = agent.getFullUrl();
7console.log(url); // http://localhost:3000/support
8
9const urlWithAuth = agent.getFullUrl(true);
10console.log(urlWithAuth); // http://user:pass@localhost:3000/support