Application<TInput, TOutput>

A DashaScript conversational application deployed to the Dasha platform.

Type parameters

NameTypeDescription
TInputRecord<string, unknown>conversation input data type
TOutputRecord<string, unknown>conversation output data type

Hierarchy

  • EventEmitter<{ error: [error: Error] ; health: [isHealthy: boolean] ; reconnecting: [attempts: number] ; unableToReconnect: [error: Error] }>

    Application

Properties

account

Readonly account: Account

A user Account that the application was deployed under.


applicationId

applicationId: string

An internal application UID.


applicationName

applicationName: string

Application name as seen in .dashaapp.


axios

Readonly axios: null | AxiosInstance

An instance of the axios HTTP client used for #httpRequest(), or null if #httpRequest() has been disabled.

Initialized with the value of DeploymentOptions.axios


connectionProvider

Optional connectionProvider: ConnectionProvider<TInput, TOutput>

A ConnectionProvider to use for this application's conversations.

deprecated use the channel argument to Conversation.execute instead


customTtsProvider

customTtsProvider: CustomTtsProvider

A CustomTtsProvider callback to use when the TTS provider is set to "custom" in {@link Conversation.audio.tts}.


customerId

Readonly customerId: string

An internal client UID.


groupId

Readonly groupId: string

An internal application group UID.


inputSchema

Optional inputSchema: unknown

JSON Schema of DSL context input variables. Conversation context: https://docs.dasha.ai/en-us/default/dasha-script-language/conversation-context


log

Readonly log: Logger


outputSchema

Optional outputSchema: unknown

JSON Schema of DSL context output variables. Conversation context: https://docs.dasha.ai/en-us/default/dasha-script-language/conversation-context


queue

Readonly queue: ConversationQueue<TInput, TOutput>

A ConversationQueue object for managing planned conversations.


sttDispatcher

sttDispatcher: SttDispatcher<TInput, TOutput>

An SttDispatcher callback that selects a speech-to-text engine for all new conversations. If not set explicitly, a "default" STT provider will be used.

deprecated use {@link Conversation.audio.stt} instead


ttsDispatcher

ttsDispatcher: TtsDispatcher<TInput, TOutput>

A TtsDispatcher callback that selects a text-to-speech engine for all new conversations. If not set explicitly, a "default" TTS provider will be used.

deprecated use {@link Conversation.audio.tts} instead

Methods

createConversation

createConversation(input?: TInput): Conversation<TInput, TOutput>

Create a single Conversation.

Parameters:

NameTypeDescription
input?TInputconversation's input data; can also be set later with Conversation.input

Returns: Conversation<TInput, TOutput>


dispose

dispose(): void

Close the connection with the application, freeing all local resources.

Returns: void


healthCheck

healthCheck(): Promise<boolean>

Returns: Promise<boolean>


setExternal

setExternal<TArgs>(name: string, fn: (args: TArgs, conv: Conversation<TInput, TOutput>) => unknown): void

Set an external call handler for this application.

The handler is called with all the call arguments passed as a dictionary, as well as the current Conversation object. It can return a JSON-serializable value, possibly wrapped in a promise, which then is treated as the call's return value. As a special case, undefined gets converted to null.

Type parameters:

NameType
TArgsRecord<string, unknown>

Parameters:

NameType
namestring
fn(args: TArgs, conv: Conversation<TInput, TOutput>) => unknown

Returns: void


start

start(options?: { concurrency?: number }): Promise<void>

Start the deployed application, enabling it to receive incoming requests and run queued conversations.

Parameters:

NameTypeDescription
options?object-
options.concurrency?numbermax number of conversations to run at once

Returns: Promise<void>


stop

stop(): Promise<void>

Stop the running application, disabling the creation of new conversations. Conversations that are already running are unaffected.

Returns: Promise<void>

Found a mistake? Email us, and we'll send you a free t-shirt!

Enroll in beta

Request invite to our private Beta program for developers to join the waitlist. No spam, we promise.