UNPKG

twilly

Version:

Node.js Twilio API abstraction layer for Express applications

21 lines (20 loc) 1.13 kB
import { Router } from 'express'; import { TwilioControllerArgs } from './twllio'; import { ExitKeywordTest, Flow, FlowSchema, OnInteractionEndHook } from './Flows'; import { InteractionContext } from './SmsCookie'; export { Flow, FlowSchema, } from './Flows'; export { Message, Question, Reply, Trigger, } from './Actions'; declare type OnMessageHook = (context?: InteractionContext, user?: any, messageBody?: string) => any; declare type OnCatchErrorHook = (context?: InteractionContext, user?: any, err?: Error) => any; declare type UserContextGetter = (from: string) => any; interface TwillyParameters extends TwilioControllerArgs { cookieSecret?: string; getUserContext?: UserContextGetter; onCatchError?: OnCatchErrorHook; onInteractionEnd?: OnInteractionEndHook; onMessage?: OnMessageHook; root: Flow; schema?: FlowSchema; testForExit?: ExitKeywordTest; } export declare function twilly({ accountSid, authToken, messagingServiceSid, root, schema, cookieKey, cookieSecret, getUserContext, onCatchError, onInteractionEnd, onMessage, sendOnExit, testForExit, }: TwillyParameters): Router;