UNPKG

twilly

Version:

Node.js Twilio API abstraction layer for Express applications

25 lines (24 loc) 1.25 kB
import { Flow, FlowSchema } from '.'; import { Action } from '../Actions'; import { InteractionContext, SmsCookie } from '../SmsCookie'; import { TwilioWebhookRequest } from '../twllio'; declare type SmsCookieUpdate = (state?: SmsCookie) => SmsCookie; export declare function pipeSmsCookieUpdates(...funcs: SmsCookieUpdate[]): SmsCookieUpdate; export declare type ExitKeywordTest = (body: string) => (boolean | Promise<boolean>); export declare type OnInteractionEndHook = (context: InteractionContext, userCtx: any) => any; export declare const defaultTestForExit: ExitKeywordTest; export interface FlowControllerOptions { onInteractionEnd?: OnInteractionEndHook; testForExit?: ExitKeywordTest; } export default class FlowController { private readonly root; private readonly schema; private testForExit; readonly onInteractionEnd: OnInteractionEndHook; constructor(root: Flow, schema?: FlowSchema, { onInteractionEnd, testForExit, }?: FlowControllerOptions); getCurrentFlow(state: SmsCookie): Flow; resolveActionFromState(req: TwilioWebhookRequest, state: SmsCookie, userCtx: any): Promise<Action>; resolveNextStateFromAction(req: TwilioWebhookRequest, state: SmsCookie, action: Action): SmsCookie; } export {};