Skip to main content

@dialstack/sdk / index / DialStackInitParams

Interface: DialStackInitParams

Defined in: sdk/src/types/core.ts:121

Initialization parameters for loadDialstackAndInitialize()

Properties

apiUrl?

optional apiUrl?: string;

Defined in: sdk/src/types/core.ts:165

Optional API endpoint URL (defaults to https://api.dialstack.ai)


appearance?

optional appearance?: AppearanceOptions;

Defined in: sdk/src/types/core.ts:160

Optional appearance configuration


fetchClientSecret

fetchClientSecret: () => Promise<ClientSecretResponse>;

Defined in: sdk/src/types/core.ts:155

Function that fetches a client secret from your backend.

Can return either:

  • A string (the client secret)
  • An object with clientSecret and optional expiresAt for optimal refresh scheduling

Returns

Promise<ClientSecretResponse>

Example

// Simple: just return the secret
fetchClientSecret: async () => {
const res = await fetch('/api/dialstack/session');
const { client_secret } = await res.json();
return client_secret;
}

// Recommended: return with expiry for optimal refresh
fetchClientSecret: async () => {
const res = await fetch('/api/dialstack/session');
const { client_secret, expires_at, account_id } = await res.json();
return {
clientSecret: client_secret,
expiresAt: expires_at,
accountId: account_id,
};
}

publishableKey

publishableKey: string;

Defined in: sdk/src/types/core.ts:125

Your DialStack publishable API key (starts with pk_live_ or pk_test_)