Skip to main content

@dialstack/sdk / index / DialStackInitParams

Interface: DialStackInitParams

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

Initialization parameters for loadDialstackAndInitialize()

Properties

apiUrl?

TypeScript
optional apiUrl?: string;

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

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


appearance?

TypeScript
optional appearance?: AppearanceOptions;

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

Optional appearance configuration


fetchClientSecret

TypeScript
fetchClientSecret: () => Promise<ClientSecretResponse>;

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

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

TypeScript
// 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

TypeScript
publishableKey: string;

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

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