UNPKG

@aws-amplify/interactions

Version:

Interactions category of aws-amplify

19 lines (16 loc) 864 B
import { resolveCtxArgs } from '@aws-amplify/core/internals/utils'; import { lexProvider } from '../AWSLexV2Provider.mjs'; import { resolveBotConfig } from '../utils/resolveBotConfig.mjs'; import { assertValidationError } from '../../errors/assertValidationError.mjs'; import { InteractionsValidationErrorCode } from '../../errors/validation.mjs'; // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 async function send(...args) { const [ctx, input] = resolveCtxArgs(args); const { botName, message } = input; const botConfig = resolveBotConfig(ctx, botName); assertValidationError(!!botConfig, InteractionsValidationErrorCode.NoBotConfig, `Bot ${botName} does not exist.`); return lexProvider.sendMessage(ctx, botConfig, message); } export { send }; //# sourceMappingURL=send.mjs.map