@dialstack/sdk-dev / js/src / DialStackInitParams
Interface: DialStackInitParams
Defined in: sdk/js/src/types/core.ts:187
Initialization parameters for loadDialstackAndInitialize()
Properties
apiUrl?
apiUrl?: string;
Defined in: sdk/js/src/types/core.ts:231
Optional API endpoint URL (defaults to https://api.dialstack.ai)
appearance?
appearance?: AppearanceOptions;
Defined in: sdk/js/src/types/core.ts:226
Optional appearance configuration
appInfo?
appInfo?: ClientAppInfo;
Defined in: sdk/js/src/types/core.ts:239
Optional name and version of your application. Sent with the SDK's own
package versions in the DialStack-Client request header, so DialStack
can tell your integration apart when diagnosing issues or planning a
deprecation.
fetchClientSecret
fetchClientSecret: () => Promise<ClientSecretResponse>;
Defined in: sdk/js/src/types/core.ts:221
Function that fetches a client secret from your backend.
Can return either:
- A string (the client secret)
- An object with
clientSecretand optionalexpiresAtfor 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/js/src/types/core.ts:191
Your DialStack publishable API key (starts with pk_live_ or pk_test_)