UNPKG

@aws-amplify/interactions

Version:

Interactions category of aws-amplify

23 lines (19 loc) 684 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { SendInput, SendOutput } from '../types'; import { lexProvider } from '../AWSLexV2Provider'; import { resolveBotConfig } from '../utils'; import { InteractionsValidationErrorCode, assertValidationError, } from '../../errors'; export const send = async (input: SendInput): Promise<SendOutput> => { const { botName, message } = input; const botConfig = resolveBotConfig(botName); assertValidationError( !!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`, ); return lexProvider.sendMessage(botConfig, message); };