-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathPostInitContext.ts
27 lines (25 loc) · 1.02 KB
/
PostInitContext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { UseLocalTools } from './useLocalTools';
import { Message } from './model/messages';
import { QuickReply } from './model/buttons';
export interface TockHistoryData {
readonly messages: Message[];
readonly quickReplies: QuickReply[];
}
export default interface PostInitContext extends UseLocalTools {
/**
* The full chat history at the time the Chat component is initialized, which includes messages from local storage
* and/or from TockContext, or null if there is no chat history at all.
*/
readonly history: TockHistoryData | null;
/**
* Sends a regular text message as if typed by a user. The message will be visible in the chat.
* @param message an arbitrary string
*/
readonly sendMessage: (message: string) => Promise<void>;
/**
* Sends a payload to the backend as if a button was triggered.
* @param payload a string representing a TOCK intent name, followed by URL-like query parameters
*/
readonly sendPayload: (payload: string) => Promise<void>;
readonly clearMessages: () => void;
}