@nlxai/core 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/README.md DELETED
@@ -1,2133 +0,0 @@
1
- ## Functions
2
-
3
- ### createConversation()
4
-
5
- ```ts
6
- function createConversation(configuration): ConversationHandler;
7
- ```
8
-
9
- Call this to create a conversation handler.
10
-
11
- #### Parameters
12
-
13
- ##### configuration
14
-
15
- [`Config`](#config)
16
-
17
- The necessary configuration to create the conversation.
18
-
19
- #### Returns
20
-
21
- [`ConversationHandler`](#conversationhandler)
22
-
23
- The [ConversationHandler](#conversationhandler) is a bundle of functions to interact with the conversation.
24
-
25
- #### Example
26
-
27
- ```typescript
28
- import { createConversation } from "@nlx/core";
29
-
30
- const conversation = createConversation({
31
- applicationUrl: "https://apps.nlx.ai/c/cfab3-243ad-232dc",
32
- headers: {
33
- "nlx-api-key": "4393029032-dwsd",
34
- },
35
- userId: "abcd-1234",
36
- languageCode: "en-US",
37
- });
38
- ```
39
-
40
- ---
41
-
42
- ### isConfigValid()
43
-
44
- ```ts
45
- function isConfigValid(configuration): boolean;
46
- ```
47
-
48
- Check whether a configuration is valid.
49
-
50
- #### Parameters
51
-
52
- ##### configuration
53
-
54
- [`Config`](#config)
55
-
56
- Conversation configuration
57
-
58
- #### Returns
59
-
60
- `boolean`
61
-
62
- Whether the configuration is valid?
63
-
64
- ---
65
-
66
- ### shouldReinitialize()
67
-
68
- ```ts
69
- function shouldReinitialize(config1, config2): boolean;
70
- ```
71
-
72
- Helper method to decide when a new [Config](#config) requires creating a new [ConversationHandler](#conversationhandler) or whether the old `Config`'s
73
- `ConversationHandler` can be used.
74
-
75
- The order of configs doesn't matter.
76
-
77
- #### Parameters
78
-
79
- ##### config1
80
-
81
- [`Config`](#config)
82
-
83
- ##### config2
84
-
85
- [`Config`](#config)
86
-
87
- #### Returns
88
-
89
- `boolean`
90
-
91
- true if `createConversation` should be called again
92
-
93
- ---
94
-
95
- ### getCurrentExpirationTimestamp()
96
-
97
- ```ts
98
- function getCurrentExpirationTimestamp(responses): number | null;
99
- ```
100
-
101
- Get current expiration timestamp from a list of responses. Can be used to determine if a conversation has timed out.
102
-
103
- #### Parameters
104
-
105
- ##### responses
106
-
107
- [`Response`](#response)[]
108
-
109
- The current list of user and application responses (first argument in the subscribe callback)
110
-
111
- #### Returns
112
-
113
- `number` \| `null`
114
-
115
- An expiration timestamp in Unix Epoch (`new Date().getTime()`), or `null` if this is not known (typically occurs if the application has not responded yet)
116
-
117
- #### Example
118
-
119
- ```typescript
120
- import { useState } from "react";
121
- import { getCurrentExpirationTimestamp } from "@nlxai/core";
122
-
123
- const [isTimedOut, setIsTimedOut] = useState(false);
124
-
125
- conversation.subscribe((responses) => {
126
- const expirationTimestamp = getCurrentExpirationTimestamp(responses);
127
- if (expirationTimestamp != null && expirationTimestamp < new Date().getTime()) {
128
- setIsTimedOut(true);
129
- }
130
- });
131
-
132
- return (<div>
133
- {isTimedOut ? (
134
- <p>Your session has timed out. Please start a new conversation.</p>
135
- ) : (
136
- <p>Your session is active.</p>
137
- )}
138
- </div>
139
- ```
140
-
141
- ---
142
-
143
- ### promisify()
144
-
145
- ```ts
146
- function promisify<Params>(
147
- fn,
148
- convo,
149
- timeout,
150
- ): (payload) => Promise<Response | null>;
151
- ```
152
-
153
- This package is intentionally designed with a subscription-based API as opposed to a promise-based one where each message corresponds to a single application response, available asynchronously.
154
-
155
- If you need a promise-based wrapper, you can use the `promisify` helper available in the package:
156
-
157
- #### Type Parameters
158
-
159
- ##### Params
160
-
161
- `Params`
162
-
163
- the type of the function's params, e.g. for `sendText` it's `text: string, context?: Context`
164
-
165
- #### Parameters
166
-
167
- ##### fn
168
-
169
- (`payload`) => `void`
170
-
171
- the function to wrap (e.g. `convo.sendText`, `convo.sendChoice`, etc.)
172
-
173
- ##### convo
174
-
175
- [`ConversationHandler`](#conversationhandler)
176
-
177
- the `ConversationHandler` (from [createConversation](#createconversation))
178
-
179
- ##### timeout
180
-
181
- `number` = `10000`
182
-
183
- the timeout in milliseconds
184
-
185
- #### Returns
186
-
187
- A promise-wrapped version of the function. The function, when called, returns a promise that resolves to the Conversation's next response.
188
-
189
- ```ts
190
- (payload): Promise<Response | null>;
191
- ```
192
-
193
- ##### Parameters
194
-
195
- ###### payload
196
-
197
- `Params`
198
-
199
- ##### Returns
200
-
201
- `Promise`\<[`Response`](#response) \| `null`\>
202
-
203
- #### Example
204
-
205
- ```typescript
206
- import { createConversation, promisify } from "@nlxai/core";
207
-
208
- const convo = createConversation(config);
209
-
210
- const sendTextWrapped = promisify(convo.sendText, convo);
211
-
212
- sendTextWrapped("Hello").then((response) => {
213
- console.log(response);
214
- });
215
- ```
216
-
217
- ---
218
-
219
- ### sendVoicePlusStep()
220
-
221
- ```ts
222
- function sendVoicePlusStep(configuration): Promise<void>;
223
- ```
224
-
225
- Use this function when using **Voice+ scripts** to advance the conversation to the step specified.
226
-
227
- This functionality is orthogonal from other usage of the core SDK, as it may be used either using standard SDK communication channels or it can be used to provide a Voice+ script experience with for instance a telephony based channel.
228
-
229
- #### Parameters
230
-
231
- ##### configuration
232
-
233
- Configuration for sending the step. Many of the values can be found on the deployment modal of the Voice+ script.
234
-
235
- ###### apiKey
236
-
237
- `string`
238
-
239
- - the API key generated for the Voice+ script. Note that this value is different from the API key you would pass to [createConversation](#createconversation). You can control the API key on the Voice+ script settings page.
240
-
241
- ###### scriptId?
242
-
243
- `string`
244
-
245
- The ID of the Voice+ script.
246
-
247
- ###### workspaceId
248
-
249
- `string`
250
-
251
- Your workspace ID.
252
-
253
- ###### conversationId
254
-
255
- `string`
256
-
257
- The active conversation ID, passed from the active NLX voice application. This is what ties the script exectution to the specific Voice application.
258
-
259
- _Note: This must be dynamically set by the voice application._ Normally, when the voice application directs the user to the webpage running this code, it will include the conversation ID as a URL parameter which you can extract and pass here.
260
-
261
- **Example**
262
-
263
- ```typescript
264
- const conversationId = new URLSearchParams(window.location.search).get("cid");
265
- ```
266
-
267
- ###### languageCode
268
-
269
- `string`
270
-
271
- The user's language code, consistent with the language codes defined on the Voice+ script.
272
-
273
- ###### step
274
-
275
- [`StepInfo`](#stepinfo)
276
-
277
- Which step to send.
278
-
279
- ###### context
280
-
281
- [`Context`](#context)
282
-
283
- Any context.
284
-
285
- ###### debug?
286
-
287
- `boolean` = `false`
288
-
289
- Set to `true` to help debug issues or errors. Defaults to `false`.
290
-
291
- #### Returns
292
-
293
- `Promise`\<`void`\>
294
-
295
- #### Example
296
-
297
- ```typescript
298
- import { sendVoicePlusStep } from "@nlxai/core";
299
-
300
- await sendVoicePlusStep({
301
- // hard-coded params
302
- apiKey: "REPLACE_WITH_API_KEY",
303
- workspaceId: "REPLACE_WITH_WORKSPACE_ID",
304
- scriptId: "REPLACE_WITH_SCRIPT_ID",
305
- step: "REPLACE_WITH_STEP_ID",
306
- // dynamic params
307
- conversationId: "REPLACE_WITH_CONVERSATION_ID",
308
- languageCode: "en-US",
309
- });
310
- ```
311
-
312
- ## Variables
313
-
314
- ### version
315
-
316
- ```ts
317
- const version: string = packageJson.version;
318
- ```
319
-
320
- Package version
321
-
322
- ## Interfaces
323
-
324
- ### Config
325
-
326
- The configuration necessary to create a conversation.
327
-
328
- #### Properties
329
-
330
- ##### applicationUrl?
331
-
332
- ```ts
333
- optional applicationUrl: string;
334
- ```
335
-
336
- The URL at which your conversational application is running. Fetch this from the application's API channel tab.
337
- Currently, there are a few ways to specify the application URL:
338
-
339
- - (recommended) leave out `applicationUrl` and specify `protocol`, `host`, `deploymentKey` and `channelKey`.
340
- - specify the full `applicationUrl` as well as the `protocol`.
341
- - (legacy) specify the `applicationUrl` generated either as an HTTP or websocket URL. Use `experimental.streamHttp` to control streaming.
342
-
343
- ##### protocol?
344
-
345
- ```ts
346
- optional protocol: Protocol;
347
- ```
348
-
349
- Specify the protocol (http, websocket or httpWithStreaming)
350
-
351
- ##### host?
352
-
353
- ```ts
354
- optional host: string;
355
- ```
356
-
357
- Hostname of the application deployment, without a leading `https://`.
358
-
359
- ##### deploymentKey?
360
-
361
- ```ts
362
- optional deploymentKey: string;
363
- ```
364
-
365
- Deployment key.
366
-
367
- ##### channelKey?
368
-
369
- ```ts
370
- optional channelKey: string;
371
- ```
372
-
373
- Channel key.
374
-
375
- ##### apiKey?
376
-
377
- ```ts
378
- optional apiKey: string;
379
- ```
380
-
381
- API key.
382
-
383
- ##### headers?
384
-
385
- ```ts
386
- optional headers: Record<string, string>;
387
- ```
388
-
389
- Headers to forward to the NLX API.
390
-
391
- ##### conversationId?
392
-
393
- ```ts
394
- optional conversationId: string;
395
- ```
396
-
397
- Set `conversationId` to continue an existing conversation. If not set, a new conversation will be started (and a new conversationId will be generated internally).
398
-
399
- ##### userId?
400
-
401
- ```ts
402
- optional userId: string;
403
- ```
404
-
405
- Setting the `userID` allows it to be searchable in application history, as well as usable via `{System.userId}` in the flow.
406
-
407
- ##### responses?
408
-
409
- ```ts
410
- optional responses: Response[];
411
- ```
412
-
413
- When `responses` is set, initialize the chatHandler with historical messages. This is useful when restoring a previous conversation, that perhaps started on a different page.
414
-
415
- ##### failureMessage?
416
-
417
- ```ts
418
- optional failureMessage: string;
419
- ```
420
-
421
- When set, this overrides the default failure message ("We encountered an issue. Please try again soon.").
422
-
423
- ##### languageCode
424
-
425
- ```ts
426
- languageCode: string;
427
- ```
428
-
429
- The language code to use for the application. In the browser this can be fetched with `navigator.language`.
430
- If you don't have translations, hard-code this to the language code you support.
431
-
432
- ##### bidirectional?
433
-
434
- ```ts
435
- optional bidirectional: boolean;
436
- ```
437
-
438
- Specifies whether the conversation is using bidirectional Voice+ (if so, an additional command socket will be opened).
439
-
440
- ---
441
-
442
- ### ConversationHandler
443
-
444
- A bundle of functions to interact with a conversation, created by [createConversation](#createconversation).
445
-
446
- #### Properties
447
-
448
- ##### sendText()
449
-
450
- ```ts
451
- sendText: (text, context?) => void;
452
- ```
453
-
454
- Send user's message
455
-
456
- ###### Parameters
457
-
458
- ###### text
459
-
460
- `string`
461
-
462
- the user's message
463
-
464
- ###### context?
465
-
466
- [`Context`](#context)
467
-
468
- [Context](https://docs.nlx.ai/platform/nlx-platform-guide/build-with-nlx/flows/context-variables#what-are-context-variables) for usage later in the flow.
469
-
470
- ###### Returns
471
-
472
- `void`
473
-
474
- ##### sendSlots()
475
-
476
- ```ts
477
- sendSlots: (slots, context?) => void;
478
- ```
479
-
480
- Send [slots](https://docs.nlx.ai/platform/nlx-platform-guide/build-with-nlx/flows/slots-custom#slot-settings) to the application.
481
-
482
- ###### Parameters
483
-
484
- ###### slots
485
-
486
- [`SlotsRecordOrArray`](#slotsrecordorarray)
487
-
488
- The slots to populate
489
-
490
- ###### context?
491
-
492
- [`Context`](#context)
493
-
494
- [Context](https://docs.nlx.ai/platform/nlx-platform-guide/build-with-nlx/flows/context-variables#what-are-context-variables) for usage later in the flow.
495
-
496
- ###### Returns
497
-
498
- `void`
499
-
500
- ##### sendChoice()
501
-
502
- ```ts
503
- sendChoice: (choiceId, context?, metadata?) => void;
504
- ```
505
-
506
- Respond to [a choice](https://docs.studio.nlx.ai/intentflows/documentation-flows/flows-build-mode/nodes#user-choice) from the application.
507
-
508
- ###### Parameters
509
-
510
- ###### choiceId
511
-
512
- `string`
513
-
514
- The `choiceId` is in the [ApplicationResponse](#applicationresponse)'s `.payload.messages[].choices[].choiceId` fields
515
-
516
- ###### context?
517
-
518
- [`Context`](#context)
519
-
520
- [Context](https://docs.nlx.ai/platform/nlx-platform-guide/build-with-nlx/flows/context-variables#what-are-context-variables) for usage later in the flow.
521
-
522
- ###### metadata?
523
-
524
- [`ChoiceRequestMetadata`](#choicerequestmetadata)
525
-
526
- links the choice to the specific message and node in the conversation.
527
-
528
- ###### Returns
529
-
530
- `void`
531
-
532
- ##### sendWelcomeFlow()
533
-
534
- ```ts
535
- sendWelcomeFlow: (context?) => void;
536
- ```
537
-
538
- Trigger the welcome flow. This should be done when the user starts interacting with the conversation.
539
-
540
- ###### Parameters
541
-
542
- ###### context?
543
-
544
- [`Context`](#context)
545
-
546
- [Context](https://docs.nlx.ai/platform/nlx-platform-guide/build-with-nlx/flows/context-variables#what-are-context-variables) for usage later in the flow.
547
-
548
- ###### Returns
549
-
550
- `void`
551
-
552
- ##### sendFlow()
553
-
554
- ```ts
555
- sendFlow: (flowId, context?) => void;
556
- ```
557
-
558
- Trigger a specific flow.
559
-
560
- ###### Parameters
561
-
562
- ###### flowId
563
-
564
- `string`
565
-
566
- the flow to trigger. The id is the name under the application's _Intents_.
567
-
568
- ###### context?
569
-
570
- [`Context`](#context)
571
-
572
- [Context](https://docs.nlx.ai/platform/nlx-platform-guide/build-with-nlx/flows/context-variables#what-are-context-variables) for usage later in the intent.
573
-
574
- ###### Returns
575
-
576
- `void`
577
-
578
- ##### sendContext()
579
-
580
- ```ts
581
- sendContext: (context) => Promise<void>;
582
- ```
583
-
584
- Send context without sending a message
585
-
586
- ###### Parameters
587
-
588
- ###### context
589
-
590
- [`Context`](#context)
591
-
592
- [Context](https://docs.nlx.ai/platform/nlx-platform-guide/build-with-nlx/flows/context-variables#what-are-context-variables) for usage later in the intent.
593
-
594
- ###### Returns
595
-
596
- `Promise`\<`void`\>
597
-
598
- ##### appendMessageToTranscript()
599
-
600
- ```ts
601
- appendMessageToTranscript: (response) => void;
602
- ```
603
-
604
- Append messages manually to the transcript. This is an advanced feature that allows routing and aggregation of different chat message
605
- sources.
606
-
607
- ###### Parameters
608
-
609
- ###### response
610
-
611
- the response with optional timestamps.
612
-
613
- `Omit`\<[`ApplicationResponse`](#applicationresponse), `"receivedAt"`\> & `object` | `Omit`\<[`UserResponse`](#userresponse), `"receivedAt"`\> & `object` | `Omit`\<[`FailureMessage`](#failuremessage-1), `"receivedAt"`\> & `object`
614
-
615
- ###### Returns
616
-
617
- `void`
618
-
619
- ##### sendStructured()
620
-
621
- ```ts
622
- sendStructured: (request, context?) => void;
623
- ```
624
-
625
- Send a combination of choice, slots, and intent in one request.
626
-
627
- ###### Parameters
628
-
629
- ###### request
630
-
631
- [`StructuredRequest`](#structuredrequest)
632
-
633
- ###### context?
634
-
635
- [`Context`](#context)
636
-
637
- [Context](https://docs.studio.nlx.ai/workspacesettings/documentation-settings/settings-context-attributes) for usage later in the intent.
638
-
639
- ###### Returns
640
-
641
- `void`
642
-
643
- ##### submitFeedback()
644
-
645
- ```ts
646
- submitFeedback: (url, feedback) => Promise<void>;
647
- ```
648
-
649
- Submit feedback about a response.
650
-
651
- ###### Parameters
652
-
653
- ###### url
654
-
655
- `string`
656
-
657
- The URL comming from the Application response `metadata.feedbackURL` field.
658
-
659
- ###### feedback
660
-
661
- Either a numerical rating or a textual comment.
662
-
663
- ###### rating?
664
-
665
- `number`
666
-
667
- ###### comment?
668
-
669
- `string`
670
-
671
- ###### Returns
672
-
673
- `Promise`\<`void`\>
674
-
675
- ##### subscribe()
676
-
677
- ```ts
678
- subscribe: (subscriber) => () => void;
679
- ```
680
-
681
- Subscribe a callback to the conversation. On subscribe, the subscriber will receive all of the Responses that the conversation has already received.
682
-
683
- ###### Parameters
684
-
685
- ###### subscriber
686
-
687
- [`Subscriber`](#subscriber)
688
-
689
- The callback to subscribe
690
-
691
- ###### Returns
692
-
693
- A function to unsubscribe the callback.
694
-
695
- ```ts
696
- (): void;
697
- ```
698
-
699
- ###### Returns
700
-
701
- `void`
702
-
703
- ##### unsubscribe()
704
-
705
- ```ts
706
- unsubscribe: (subscriber) => void;
707
- ```
708
-
709
- Unsubscribe a callback from the conversation.
710
-
711
- ###### Parameters
712
-
713
- ###### subscriber
714
-
715
- [`Subscriber`](#subscriber)
716
-
717
- The callback to unsubscribe
718
-
719
- ###### Returns
720
-
721
- `void`
722
-
723
- ##### unsubscribeAll()
724
-
725
- ```ts
726
- unsubscribeAll: () => void;
727
- ```
728
-
729
- Unsubscribe all callback from the conversation.
730
-
731
- ###### Returns
732
-
733
- `void`
734
-
735
- ##### currentConversationId()
736
-
737
- ```ts
738
- currentConversationId: () => string | undefined;
739
- ```
740
-
741
- Get the current conversation ID if it's set, or undefined if there is no conversation.
742
-
743
- ###### Returns
744
-
745
- `string` \| `undefined`
746
-
747
- ##### currentLanguageCode()
748
-
749
- ```ts
750
- currentLanguageCode: () => string;
751
- ```
752
-
753
- Get the current language code
754
-
755
- ###### Returns
756
-
757
- `string`
758
-
759
- ##### setLanguageCode()
760
-
761
- ```ts
762
- setLanguageCode: (languageCode) => void;
763
- ```
764
-
765
- Set the language code
766
-
767
- ###### Parameters
768
-
769
- ###### languageCode
770
-
771
- `string`
772
-
773
- ###### Returns
774
-
775
- `void`
776
-
777
- ##### reset()
778
-
779
- ```ts
780
- reset: (options?) => void;
781
- ```
782
-
783
- Forces a new conversation. If `clearResponses` is set to true, will also clear historical responses passed to subscribers.
784
- Retains all existing subscribers.
785
-
786
- ###### Parameters
787
-
788
- ###### options?
789
-
790
- ###### clearResponses?
791
-
792
- `boolean`
793
-
794
- If set to true, will clear historical responses passed to subscribers.
795
-
796
- ###### Returns
797
-
798
- `void`
799
-
800
- ##### destroy()
801
-
802
- ```ts
803
- destroy: () => void;
804
- ```
805
-
806
- Removes all subscribers and, if using websockets, closes the connection.
807
-
808
- ###### Returns
809
-
810
- `void`
811
-
812
- ##### setRequestOverride()
813
-
814
- ```ts
815
- setRequestOverride: (override) => void;
816
- ```
817
-
818
- Optional [RequestOverride](#requestoverride) function used to bypass the application request and handle them in a custom fashion
819
-
820
- ###### Parameters
821
-
822
- ###### override
823
-
824
- [`RequestOverride`](#requestoverride) | `undefined`
825
-
826
- ###### Returns
827
-
828
- `void`
829
-
830
- ##### addEventListener()
831
-
832
- ```ts
833
- addEventListener: (event, handler) => void;
834
- ```
835
-
836
- Add a listener to one of the handler's custom events
837
-
838
- ###### Parameters
839
-
840
- ###### event
841
-
842
- [`ConversationHandlerEvent`](#conversationhandlerevent)
843
-
844
- ###### handler
845
-
846
- [`VoicePlusCommandListener`](#voicepluscommandlistener) | [`InterimMessageListener`](#interimmessagelistener)
847
-
848
- ###### Returns
849
-
850
- `void`
851
-
852
- ##### removeEventListener()
853
-
854
- ```ts
855
- removeEventListener: (event, handler) => void;
856
- ```
857
-
858
- Remove a listener to one of the handler's custom events
859
-
860
- ###### Parameters
861
-
862
- ###### event
863
-
864
- [`ConversationHandlerEvent`](#conversationhandlerevent)
865
-
866
- ###### handler
867
-
868
- [`VoicePlusCommandListener`](#voicepluscommandlistener) | [`InterimMessageListener`](#interimmessagelistener)
869
-
870
- ###### Returns
871
-
872
- `void`
873
-
874
- ---
875
-
876
- ### SlotValue
877
-
878
- Values to fill an intent's [attached slots](https://docs.studio.nlx.ai/intents/documentation-intents/intents-attached-slots).
879
-
880
- An array of `SlotValue` objects is equivalent to a [SlotsRecord](#slotsrecord).
881
-
882
- #### Properties
883
-
884
- ##### slotId
885
-
886
- ```ts
887
- slotId: string;
888
- ```
889
-
890
- The attached slot's name
891
-
892
- ##### value
893
-
894
- ```ts
895
- value: any;
896
- ```
897
-
898
- Usually this will be a discrete value matching the slots's [type](https://docs.studio.nlx.ai/slots/documentation-slots/slots-values#system-slots).
899
- for custom slots, this can optionally be the value's ID.
900
-
901
- ---
902
-
903
- ### ApplicationResponse
904
-
905
- A message from the application
906
-
907
- See also:
908
-
909
- - [UserResponse](#userresponse)
910
- - [FailureMessage](#failuremessage-1)
911
- - [Response](#response)
912
-
913
- #### Properties
914
-
915
- ##### type
916
-
917
- ```ts
918
- type: Application;
919
- ```
920
-
921
- The application response type
922
-
923
- ##### receivedAt
924
-
925
- ```ts
926
- receivedAt: number;
927
- ```
928
-
929
- When the response was received
930
-
931
- ##### payload
932
-
933
- ```ts
934
- payload: ApplicationResponsePayload;
935
- ```
936
-
937
- The payload of the response
938
-
939
- ---
940
-
941
- ### ApplicationResponsePayload
942
-
943
- The payload of the application response
944
-
945
- #### Properties
946
-
947
- ##### expirationTimestamp?
948
-
949
- ```ts
950
- optional expirationTimestamp: number;
951
- ```
952
-
953
- If there isn't some interaction by this time, the conversation will expire.
954
-
955
- ##### conversationId?
956
-
957
- ```ts
958
- optional conversationId: string;
959
- ```
960
-
961
- The active conversation ID. If not set, a new conversation will be started.
962
-
963
- ##### messages
964
-
965
- ```ts
966
- messages: ApplicationMessage[];
967
- ```
968
-
969
- Any messages from the application.
970
-
971
- ##### metadata?
972
-
973
- ```ts
974
- optional metadata: ApplicationResponseMetadata;
975
- ```
976
-
977
- Global state about the current conversation
978
- as well as whether the client should poll for more application responses.
979
-
980
- ##### payload?
981
-
982
- ```ts
983
- optional payload: string;
984
- ```
985
-
986
- If configured, the [node's payload.](See: https://docs.studio.nlx.ai/intentflows/documentation-flows/flows-build-mode/advanced-messaging-+-functionality#add-functionality)
987
-
988
- ##### modalities?
989
-
990
- ```ts
991
- optional modalities: ModalityPayloads;
992
- ```
993
-
994
- If configured, the node's modalities and their payloads.
995
-
996
- ##### context?
997
-
998
- ```ts
999
- optional context: Context;
1000
- ```
1001
-
1002
- If the node is set to send context, the whole context associated with the conversation.
1003
-
1004
- ---
1005
-
1006
- ### ApplicationResponseMetadata
1007
-
1008
- Global state about the current conversation
1009
- as well as whether the client should poll for more application responses.
1010
-
1011
- #### Properties
1012
-
1013
- ##### intentId?
1014
-
1015
- ```ts
1016
- optional intentId: string;
1017
- ```
1018
-
1019
- The conversation's intent
1020
-
1021
- ##### escalation?
1022
-
1023
- ```ts
1024
- optional escalation: boolean;
1025
- ```
1026
-
1027
- Whether the current conversation has been marked as incomprehension.
1028
-
1029
- ##### frustration?
1030
-
1031
- ```ts
1032
- optional frustration: boolean;
1033
- ```
1034
-
1035
- Whether the current conversation has been marked frustrated
1036
-
1037
- ##### incomprehension?
1038
-
1039
- ```ts
1040
- optional incomprehension: boolean;
1041
- ```
1042
-
1043
- Whether the current conversation has been marked as incomprehension.
1044
-
1045
- ##### uploadUrls
1046
-
1047
- ```ts
1048
- uploadUrls: UploadUrl[];
1049
- ```
1050
-
1051
- Upload URL's
1052
-
1053
- ##### hasPendingDataRequest?
1054
-
1055
- ```ts
1056
- optional hasPendingDataRequest: boolean;
1057
- ```
1058
-
1059
- Whether the client should poll for more application responses.
1060
-
1061
- ##### sources?
1062
-
1063
- ```ts
1064
- optional sources: KnowledgeBaseResponseSource[];
1065
- ```
1066
-
1067
- Knowledge base sources
1068
-
1069
- ##### feedbackUrl?
1070
-
1071
- ```ts
1072
- optional feedbackUrl: string;
1073
- ```
1074
-
1075
- URL to use for submitting feedback about this response. See `feedbackConfig` for what the expected feedback type is.
1076
-
1077
- You can pass this as the first argument to `submitFeedback`.
1078
-
1079
- ##### feedbackConfig?
1080
-
1081
- ```ts
1082
- optional feedbackConfig: FeedbackConfiguration;
1083
- ```
1084
-
1085
- If present, the application would like to collect feedback from the user.
1086
-
1087
- ---
1088
-
1089
- ### KnowledgeBaseResponseSource
1090
-
1091
- Response for knowlege base sources
1092
-
1093
- #### Properties
1094
-
1095
- ##### fileName?
1096
-
1097
- ```ts
1098
- optional fileName: string;
1099
- ```
1100
-
1101
- File name
1102
-
1103
- ##### pageNumber?
1104
-
1105
- ```ts
1106
- optional pageNumber: number;
1107
- ```
1108
-
1109
- Page number
1110
-
1111
- ##### content?
1112
-
1113
- ```ts
1114
- optional content: string;
1115
- ```
1116
-
1117
- Content
1118
-
1119
- ##### metadata?
1120
-
1121
- ```ts
1122
- optional metadata: Record<string, unknown>;
1123
- ```
1124
-
1125
- Metadata
1126
-
1127
- ##### presignedUrl?
1128
-
1129
- ```ts
1130
- optional presignedUrl: string;
1131
- ```
1132
-
1133
- Presigned URL for direct retrieval
1134
-
1135
- ---
1136
-
1137
- ### ApplicationMessageMetadata
1138
-
1139
- Metadata for the individual application message
1140
- as well as whether the client should poll for more application responses.
1141
-
1142
- #### Properties
1143
-
1144
- ##### intentId?
1145
-
1146
- ```ts
1147
- optional intentId: string;
1148
- ```
1149
-
1150
- The message node's intent
1151
-
1152
- ---
1153
-
1154
- ### ApplicationMessage
1155
-
1156
- A message from the application, as well as any choices the user can make.
1157
-
1158
- #### Properties
1159
-
1160
- ##### messageId?
1161
-
1162
- ```ts
1163
- optional messageId: string;
1164
- ```
1165
-
1166
- A unique identifier for the message.
1167
-
1168
- ##### nodeId?
1169
-
1170
- ```ts
1171
- optional nodeId: string;
1172
- ```
1173
-
1174
- The node id that this message is associated with.
1175
- This is must be sent with a choice when the user is changing a previously sent choice.
1176
-
1177
- ##### text
1178
-
1179
- ```ts
1180
- text: string;
1181
- ```
1182
-
1183
- The body of the message. Show this to the user.
1184
-
1185
- ##### choices
1186
-
1187
- ```ts
1188
- choices: Choice[];
1189
- ```
1190
-
1191
- A selection of choices to show to the user. They may choose one of them.
1192
-
1193
- ##### metadata?
1194
-
1195
- ```ts
1196
- optional metadata: ApplicationMessageMetadata;
1197
- ```
1198
-
1199
- Metadata
1200
-
1201
- ##### selectedChoiceId?
1202
-
1203
- ```ts
1204
- optional selectedChoiceId: string;
1205
- ```
1206
-
1207
- After a choice has been made by the user, this will be updated locally to the selected choice id.
1208
- This field is set locally and does not come from the application.
1209
-
1210
- ---
1211
-
1212
- ### UploadUrl
1213
-
1214
- The upload destination for handling conversing with files
1215
-
1216
- #### Properties
1217
-
1218
- ##### url
1219
-
1220
- ```ts
1221
- url: string;
1222
- ```
1223
-
1224
- The URL of the upload
1225
-
1226
- ##### uploadId
1227
-
1228
- ```ts
1229
- uploadId: string;
1230
- ```
1231
-
1232
- The ID of the upload
1233
-
1234
- ---
1235
-
1236
- ### Choice
1237
-
1238
- A choices to show to the user.
1239
-
1240
- #### Properties
1241
-
1242
- ##### choiceId
1243
-
1244
- ```ts
1245
- choiceId: string;
1246
- ```
1247
-
1248
- `choiceId` is used by `sendChoice` to let the user choose this choice.
1249
-
1250
- ##### choiceText
1251
-
1252
- ```ts
1253
- choiceText: string;
1254
- ```
1255
-
1256
- The text of the choice
1257
-
1258
- ##### choicePayload?
1259
-
1260
- ```ts
1261
- optional choicePayload: any;
1262
- ```
1263
-
1264
- An optional, schemaless payload for the choice.
1265
-
1266
- ---
1267
-
1268
- ### UserResponse
1269
-
1270
- A message from the user
1271
-
1272
- See also:
1273
-
1274
- - [ApplicationResponse](#applicationresponse)
1275
- - [FailureMessage](#failuremessage-1)
1276
- - [Response](#response)
1277
-
1278
- #### Properties
1279
-
1280
- ##### type
1281
-
1282
- ```ts
1283
- type: User;
1284
- ```
1285
-
1286
- The user response type
1287
-
1288
- ##### receivedAt
1289
-
1290
- ```ts
1291
- receivedAt: number;
1292
- ```
1293
-
1294
- When the response was received
1295
-
1296
- ##### payload
1297
-
1298
- ```ts
1299
- payload: UserResponsePayload;
1300
- ```
1301
-
1302
- The payload of the response
1303
-
1304
- ---
1305
-
1306
- ### FailureMessage
1307
-
1308
- A failure message is received when the NLX api is unreachable, or sends an unparsable response.
1309
-
1310
- #### Properties
1311
-
1312
- ##### type
1313
-
1314
- ```ts
1315
- type: Failure;
1316
- ```
1317
-
1318
- The failure response type
1319
-
1320
- ##### payload
1321
-
1322
- ```ts
1323
- payload: object;
1324
- ```
1325
-
1326
- The payload only includes an error message.
1327
-
1328
- ###### text
1329
-
1330
- ```ts
1331
- text: string;
1332
- ```
1333
-
1334
- The error message is either the default, or the `failureMessage` set in the [Config](#config).
1335
-
1336
- ##### receivedAt
1337
-
1338
- ```ts
1339
- receivedAt: number;
1340
- ```
1341
-
1342
- When the failure occurred.
1343
-
1344
- ---
1345
-
1346
- ### FeedbackConfiguration
1347
-
1348
- Configuration for feedback collection. You can use this to render an appropriate feedback widget in your application.
1349
-
1350
- #### Properties
1351
-
1352
- ##### feedbackId
1353
-
1354
- ```ts
1355
- feedbackId: string;
1356
- ```
1357
-
1358
- Unique identifier for the feedback collection.
1359
-
1360
- ##### feedbackName
1361
-
1362
- ```ts
1363
- feedbackName: string;
1364
- ```
1365
-
1366
- Human readable name of this feedback collection.
1367
-
1368
- ##### feedbackType
1369
-
1370
- ```ts
1371
- feedbackType: object;
1372
- ```
1373
-
1374
- Type of feedback being collected.
1375
- At the moment only binary feedback is supported, but we plan to introduce more types in the future.
1376
- Hence your code should make sure to check the `type` attribute to make sure the expected feedback type is handled.
1377
-
1378
- ###### type
1379
-
1380
- ```ts
1381
- type: "binary";
1382
- ```
1383
-
1384
- A binary feedback type is a thumbs up/down sort of choice.
1385
-
1386
- ###### config
1387
-
1388
- ```ts
1389
- config: object;
1390
- ```
1391
-
1392
- Configuration specific to binary feedback.
1393
-
1394
- ###### config.positiveValue
1395
-
1396
- ```ts
1397
- positiveValue: number;
1398
- ```
1399
-
1400
- Value to send for positive feedback. Default `1`.
1401
-
1402
- ###### config.negativeValue
1403
-
1404
- ```ts
1405
- negativeValue: number;
1406
- ```
1407
-
1408
- Value to send for negative feedback. Default `-1`.
1409
-
1410
- ##### commentsEnabled
1411
-
1412
- ```ts
1413
- commentsEnabled: boolean;
1414
- ```
1415
-
1416
- Whether comments are enabled for this feedback collection.
1417
-
1418
- ##### question?
1419
-
1420
- ```ts
1421
- optional question: string;
1422
- ```
1423
-
1424
- Optional question to show to the user when collecting feedback.
1425
-
1426
- ##### labels
1427
-
1428
- ```ts
1429
- labels: object;
1430
- ```
1431
-
1432
- Labels for individual feedback UI elements as customised by the builder.
1433
-
1434
- ###### positive?
1435
-
1436
- ```ts
1437
- optional positive: string;
1438
- ```
1439
-
1440
- Label for positive feedback
1441
-
1442
- ###### negative?
1443
-
1444
- ```ts
1445
- optional negative: string;
1446
- ```
1447
-
1448
- Label for negative feedback
1449
-
1450
- ###### comment?
1451
-
1452
- ```ts
1453
- optional comment: string;
1454
- ```
1455
-
1456
- Label for comment
1457
-
1458
- ---
1459
-
1460
- ### StructuredRequest
1461
-
1462
- The body of `sendStructured`
1463
- Includes a combination of choice, slots, and intent in one request.
1464
-
1465
- #### Properties
1466
-
1467
- ##### choiceId?
1468
-
1469
- ```ts
1470
- optional choiceId: string;
1471
- ```
1472
-
1473
- The `choiceId` is in the [ApplicationResponse](#applicationresponse)'s `.payload.messages[].choices[].choiceId` fields
1474
-
1475
- ##### nodeId?
1476
-
1477
- ```ts
1478
- optional nodeId: string;
1479
- ```
1480
-
1481
- Required if you want to change a choice that's already been sent.
1482
- The `nodeId` can be found in the corresponding [ApplicationMessage](#applicationmessage).
1483
-
1484
- ##### ~~intentId?~~
1485
-
1486
- ```ts
1487
- optional intentId: string;
1488
- ```
1489
-
1490
- The intent to trigger. The `intentId` is the name under the application's _Intents_.
1491
-
1492
- ###### Deprecated
1493
-
1494
- use `flowId` instead.
1495
-
1496
- ##### flowId?
1497
-
1498
- ```ts
1499
- optional flowId: string;
1500
- ```
1501
-
1502
- The flow to trigger. The `flowId` is the name under the application's _Flows_.
1503
-
1504
- ##### slots?
1505
-
1506
- ```ts
1507
- optional slots: SlotsRecordOrArray;
1508
- ```
1509
-
1510
- The slots to populate
1511
-
1512
- ##### uploadIds?
1513
-
1514
- ```ts
1515
- optional uploadIds: string[];
1516
- ```
1517
-
1518
- Upload ID
1519
-
1520
- ##### utterance?
1521
-
1522
- ```ts
1523
- optional utterance: string;
1524
- ```
1525
-
1526
- Upload utterance
1527
-
1528
- ---
1529
-
1530
- ### ApplicationRequest
1531
-
1532
- The request data actually sent to the application, slightly different from [UserResponsePayload](#userresponsepayload-1), which includes some UI-specific information
1533
-
1534
- #### Properties
1535
-
1536
- ##### conversationId?
1537
-
1538
- ```ts
1539
- optional conversationId: string;
1540
- ```
1541
-
1542
- The current conversation ID
1543
-
1544
- ##### userId?
1545
-
1546
- ```ts
1547
- optional userId: string;
1548
- ```
1549
-
1550
- The current user ID
1551
-
1552
- ##### context?
1553
-
1554
- ```ts
1555
- optional context: Context;
1556
- ```
1557
-
1558
- Request context, if applicable
1559
-
1560
- ##### request
1561
-
1562
- ```ts
1563
- request: object;
1564
- ```
1565
-
1566
- Main request
1567
-
1568
- ###### unstructured?
1569
-
1570
- ```ts
1571
- optional unstructured: object;
1572
- ```
1573
-
1574
- Unstructured request
1575
-
1576
- ###### unstructured.text
1577
-
1578
- ```ts
1579
- text: string;
1580
- ```
1581
-
1582
- Request body text
1583
-
1584
- ###### structured?
1585
-
1586
- ```ts
1587
- optional structured: StructuredRequest & object;
1588
- ```
1589
-
1590
- Structured request
1591
-
1592
- ###### Type Declaration
1593
-
1594
- ###### slots?
1595
-
1596
- ```ts
1597
- optional slots: SlotValue[];
1598
- ```
1599
-
1600
- Only array-form slots are allowed for the purposes of sending to the backend
1601
-
1602
- ---
1603
-
1604
- ### VoiceCredentials
1605
-
1606
- Credentials to connect to a Voice channel
1607
-
1608
- #### Properties
1609
-
1610
- ##### url
1611
-
1612
- ```ts
1613
- url: string;
1614
- ```
1615
-
1616
- Voice Connection URL
1617
-
1618
- ##### roomName
1619
-
1620
- ```ts
1621
- roomName: string;
1622
- ```
1623
-
1624
- Voice room name
1625
-
1626
- ##### token
1627
-
1628
- ```ts
1629
- token: string;
1630
- ```
1631
-
1632
- Voice token
1633
-
1634
- ##### participantName
1635
-
1636
- ```ts
1637
- participantName: string;
1638
- ```
1639
-
1640
- Voice participant name
1641
-
1642
- ---
1643
-
1644
- ### ChoiceRequestMetadata
1645
-
1646
- Helps link the choice to the specific message in the conversation.
1647
-
1648
- #### Properties
1649
-
1650
- ##### responseIndex?
1651
-
1652
- ```ts
1653
- optional responseIndex: number;
1654
- ```
1655
-
1656
- The index of the [Response](#response) associated with this choice.
1657
- Setting this ensures that local state's `selectedChoiceId` on the corresponding [ApplicationResponse](#applicationresponse) is set.
1658
- It is not sent to the application.
1659
-
1660
- ##### messageIndex?
1661
-
1662
- ```ts
1663
- optional messageIndex: number;
1664
- ```
1665
-
1666
- The index of the [ApplicationMessage](#applicationmessage) associated with this choice.
1667
- Setting this ensures that local state's `selectedChoiceId` on the corresponding [ApplicationResponse](#applicationresponse) is set.
1668
- It is not sent to the application.
1669
-
1670
- ##### nodeId?
1671
-
1672
- ```ts
1673
- optional nodeId: string;
1674
- ```
1675
-
1676
- Required if you want to change a choice that's already been sent.
1677
- The `nodeId` can be found in the corresponding [ApplicationMessage](#applicationmessage).
1678
-
1679
- ##### intentId?
1680
-
1681
- ```ts
1682
- optional intentId: string;
1683
- ```
1684
-
1685
- Intent ID, used for sending to the NLU to allow it to double-check
1686
-
1687
- ---
1688
-
1689
- ### VoicePlusMessage
1690
-
1691
- Messages sent to the Voice+ socket
1692
-
1693
- #### Properties
1694
-
1695
- ##### context
1696
-
1697
- ```ts
1698
- context: any;
1699
- ```
1700
-
1701
- Voice+ context
1702
-
1703
- ---
1704
-
1705
- ### EventHandlers
1706
-
1707
- Dictionary of handler methods per event
1708
-
1709
- #### Properties
1710
-
1711
- ##### voicePlusCommand
1712
-
1713
- ```ts
1714
- voicePlusCommand: VoicePlusCommandListener;
1715
- ```
1716
-
1717
- Voice+ command event handler
1718
-
1719
- ##### interimMessage
1720
-
1721
- ```ts
1722
- interimMessage: InterimMessageListener;
1723
- ```
1724
-
1725
- Interim message event handler
1726
-
1727
- ## Enumerations
1728
-
1729
- ### Protocol
1730
-
1731
- The protocol used to communicate with the application
1732
-
1733
- #### Enumeration Members
1734
-
1735
- ##### Https
1736
-
1737
- ```ts
1738
- Https: "https";
1739
- ```
1740
-
1741
- Regular encrypted HTTPS, without support for post-escalation message handling, interim messages and other streaming features.
1742
-
1743
- ##### HttpsWithStreaming
1744
-
1745
- ```ts
1746
- HttpsWithStreaming: "httpsWithStreaming";
1747
- ```
1748
-
1749
- Encrypted HTTPS with streaming enabled. This is the default setting and supports interim messages. Does not support post-escalation message handling.
1750
-
1751
- ##### Websocket
1752
-
1753
- ```ts
1754
- Websocket: "websocket";
1755
- ```
1756
-
1757
- Websocket, with support for post-escalation message handling.
1758
-
1759
- ---
1760
-
1761
- ### ResponseType
1762
-
1763
- Response type
1764
-
1765
- #### Enumeration Members
1766
-
1767
- ##### Application
1768
-
1769
- ```ts
1770
- Application: "bot";
1771
- ```
1772
-
1773
- Response from the application
1774
-
1775
- ##### User
1776
-
1777
- ```ts
1778
- User: "user";
1779
- ```
1780
-
1781
- Response from the user
1782
-
1783
- ##### Failure
1784
-
1785
- ```ts
1786
- Failure: "failure";
1787
- ```
1788
-
1789
- Generic failure (cannot be attributed to the application)
1790
-
1791
- ## Events
1792
-
1793
- ### ConversationHandlerEvent
1794
-
1795
- ```ts
1796
- type ConversationHandlerEvent = "voicePlusCommand" | "interimMessage";
1797
- ```
1798
-
1799
- Handler events
1800
- voicePlusCommand
1801
-
1802
- ## Type Aliases
1803
-
1804
- ### Context
1805
-
1806
- ```ts
1807
- type Context = Record<string, any>;
1808
- ```
1809
-
1810
- [Context](https://docs.studio.nlx.ai/workspacesettings/documentation-settings/settings-context-attributes) for usage later in the intent.
1811
-
1812
- ---
1813
-
1814
- ### SlotsRecord
1815
-
1816
- ```ts
1817
- type SlotsRecord = Record<string, any>;
1818
- ```
1819
-
1820
- Values to fill an intent's [attached slots](https://docs.studio.nlx.ai/intents/documentation-intents/intents-attached-slots).
1821
-
1822
- `SlotRecord` Keys are the attached slot's name
1823
-
1824
- `SlotRecord` Values are usually a discrete value matching the slots's [type](https://docs.studio.nlx.ai/slots/documentation-slots/slots-values#system-slots).
1825
- for custom slots, this can optionally be the value's ID.
1826
-
1827
- A `SlotsRecord` is equivalent to an array of [SlotValue](#slotvalue) objects.
1828
-
1829
- ---
1830
-
1831
- ### SlotsRecordOrArray
1832
-
1833
- ```ts
1834
- type SlotsRecordOrArray = SlotsRecord | SlotValue[];
1835
- ```
1836
-
1837
- Values to fill an intent's [attached slots](https://docs.studio.nlx.ai/intents/documentation-intents/intents-attached-slots).
1838
-
1839
- Supports either a [SlotsRecord](#slotsrecord) or an array of [SlotValue](#slotvalue) objects
1840
-
1841
- ---
1842
-
1843
- ### ModalityPayloads
1844
-
1845
- ```ts
1846
- type ModalityPayloads = Record<string, any>;
1847
- ```
1848
-
1849
- Payloads for modalities as a key-value pair by modality name
1850
-
1851
- ---
1852
-
1853
- ### UserResponsePayload
1854
-
1855
- ```ts
1856
- type UserResponsePayload =
1857
- | {
1858
- type: "text";
1859
- text: string;
1860
- context?: Context;
1861
- }
1862
- | {
1863
- type: "choice";
1864
- choiceId: string;
1865
- context?: Context;
1866
- }
1867
- | (object & StructuredRequest);
1868
- ```
1869
-
1870
- The payload of the user response
1871
-
1872
- #### Type Declaration
1873
-
1874
- ```ts
1875
- {
1876
- type: "text";
1877
- text: string;
1878
- context?: Context;
1879
- }
1880
- ```
1881
-
1882
- ##### type
1883
-
1884
- ```ts
1885
- type: "text";
1886
- ```
1887
-
1888
- Set when `sendText` is called.
1889
-
1890
- ##### text
1891
-
1892
- ```ts
1893
- text: string;
1894
- ```
1895
-
1896
- The user's message
1897
-
1898
- ##### context?
1899
-
1900
- ```ts
1901
- optional context: Context;
1902
- ```
1903
-
1904
- [Context](https://docs.studio.nlx.ai/workspacesettings/documentation-settings/settings-context-attributes) for usage later in the intent.
1905
-
1906
- ```ts
1907
- {
1908
- type: "choice";
1909
- choiceId: string;
1910
- context?: Context;
1911
- }
1912
- ```
1913
-
1914
- ##### type
1915
-
1916
- ```ts
1917
- type: "choice";
1918
- ```
1919
-
1920
- Set when `sendChoice` is called.
1921
-
1922
- ##### choiceId
1923
-
1924
- ```ts
1925
- choiceId: string;
1926
- ```
1927
-
1928
- The `choiceId` passed to `sendChoice`
1929
- Correlates to a `choiceId` in the [ApplicationResponse](#applicationresponse)'s `.payload.messages[].choices[].choiceId` fields
1930
-
1931
- ##### context?
1932
-
1933
- ```ts
1934
- optional context: Context;
1935
- ```
1936
-
1937
- [Context](https://docs.studio.nlx.ai/workspacesettings/documentation-settings/settings-context-attributes) for usage later in the intent.
1938
-
1939
- `object` & [`StructuredRequest`](#structuredrequest)
1940
-
1941
- ---
1942
-
1943
- ### Response
1944
-
1945
- ```ts
1946
- type Response = ApplicationResponse | UserResponse | FailureMessage;
1947
- ```
1948
-
1949
- A response from the application or the user.
1950
-
1951
- ---
1952
-
1953
- ### Time
1954
-
1955
- ```ts
1956
- type Time = number;
1957
- ```
1958
-
1959
- The time value in milliseconds since midnight, January 1, 1970 UTC.
1960
-
1961
- ---
1962
-
1963
- ### NormalizedStructuredRequest
1964
-
1965
- ```ts
1966
- type NormalizedStructuredRequest = StructuredRequest & object;
1967
- ```
1968
-
1969
- Normalized structured request with a single way to represent slots
1970
-
1971
- #### Type Declaration
1972
-
1973
- ##### slots?
1974
-
1975
- ```ts
1976
- optional slots: SlotValue[];
1977
- ```
1978
-
1979
- Only array-form slots are allowed for the purposes of sending to the backend
1980
-
1981
- ---
1982
-
1983
- ### LanguageCode
1984
-
1985
- ```ts
1986
- type LanguageCode = string;
1987
- ```
1988
-
1989
- Language code named for clarity, may restrict it to a finite list
1990
-
1991
- ---
1992
-
1993
- ### RequestOverride()
1994
-
1995
- ```ts
1996
- type RequestOverride = (applicationRequest, appendResponse) => void;
1997
- ```
1998
-
1999
- Instead of sending a request to the application, handle it in a custom fashion
2000
-
2001
- #### Parameters
2002
-
2003
- ##### applicationRequest
2004
-
2005
- [`ApplicationRequest`](#applicationrequest)
2006
-
2007
- The [ApplicationRequest](#applicationrequest) that is being overridden
2008
-
2009
- ##### appendResponse
2010
-
2011
- (`res`) => `void`
2012
-
2013
- A method to append the [ApplicationResponsePayload](#applicationresponsepayload-1) to the message history
2014
-
2015
- #### Returns
2016
-
2017
- `void`
2018
-
2019
- ---
2020
-
2021
- ### VoicePlusContext
2022
-
2023
- ```ts
2024
- type VoicePlusContext = any;
2025
- ```
2026
-
2027
- Voice+ context, type to be defined
2028
-
2029
- ---
2030
-
2031
- ### VoicePlusCommandListener()
2032
-
2033
- ```ts
2034
- type VoicePlusCommandListener = (payload) => void;
2035
- ```
2036
-
2037
- Voice+ command listener
2038
-
2039
- #### Parameters
2040
-
2041
- ##### payload
2042
-
2043
- `any`
2044
-
2045
- #### Returns
2046
-
2047
- `void`
2048
-
2049
- ---
2050
-
2051
- ### InterimMessageListener()
2052
-
2053
- ```ts
2054
- type InterimMessageListener = (message?) => void;
2055
- ```
2056
-
2057
- Interim message listener
2058
-
2059
- #### Parameters
2060
-
2061
- ##### message?
2062
-
2063
- `string`
2064
-
2065
- #### Returns
2066
-
2067
- `void`
2068
-
2069
- ---
2070
-
2071
- ### Subscriber()
2072
-
2073
- ```ts
2074
- type Subscriber = (response, newResponse?) => void;
2075
- ```
2076
-
2077
- The callback function for listening to all responses.
2078
-
2079
- #### Parameters
2080
-
2081
- ##### response
2082
-
2083
- [`Response`](#response)[]
2084
-
2085
- ##### newResponse?
2086
-
2087
- [`Response`](#response)
2088
-
2089
- #### Returns
2090
-
2091
- `void`
2092
-
2093
- ---
2094
-
2095
- ### StepInfo
2096
-
2097
- ```ts
2098
- type StepInfo =
2099
- | string
2100
- | {
2101
- stepId: string;
2102
- stepTriggerDescription?: string;
2103
- };
2104
- ```
2105
-
2106
- Step information, either a step ID as a single string or an object
2107
-
2108
- #### Type Declaration
2109
-
2110
- `string`
2111
-
2112
- ```ts
2113
- {
2114
- stepId: string;
2115
- stepTriggerDescription?: string;
2116
- }
2117
- ```
2118
-
2119
- ##### stepId
2120
-
2121
- ```ts
2122
- stepId: string;
2123
- ```
2124
-
2125
- Step ID
2126
-
2127
- ##### stepTriggerDescription?
2128
-
2129
- ```ts
2130
- optional stepTriggerDescription: string;
2131
- ```
2132
-
2133
- Step trigger description