@xapp/stentor-lex-v2
v1.86.13
Published
Stentor Lex V2 channel for stentor
Downloads
6,022
Readme
@xapp/stentor-lex-v2
Stentor channel for Amazon Lex V2 fulfillment requests (recognized by bot.aliasId + invocationSource), including calls routed through Amazon Connect, Genesys, or the Lex V2 test console. It guesses the originating channel from sessionState.sessionAttributes/requestAttributes to compute device capabilities and translates the V2 request/response shape using its own Lex V2 models (it uses untagIntent from @xapp/stentor-service-lex to strip the V2 intent suffix). Like @xapp/stentor-lex-connect, it ships a preExecution hook that short-circuits NLU-test calls (user ids starting with query.) by returning the detected intent and slots in the session attributes instead of running the full conversation.
Usage
import { LexV2Channel } from "@xapp/stentor-lex-v2";
const channel = LexV2Channel();
// channel.test(body) -> true for Lex V2 fulfillment requests
// channel.request.translate(body) -> normalized Stentor Request
// channel.response -> translates a Stentor Response into a Lex V2 response