我想通过将一个输入(话语)传递给我的bot来从lambda函数调用我的lex bot.
以下是我的Python代码:
import boto3
import json
def lambda_handler(event, context):
print(event)
# Create a new Amazon Lex runtime client
client = boto3.client('lex-runtime')
# Send the user's input to the bot
response = client.post_text(
botName='BotName',
botAlias='BotAlias',
userId='UserID',
inputText=event['input']
)
# Return the bot's response to the caller
return {
'output': response['message']
}
我得到以下错误:
"errorMessage":"无法连接到终结点url:"https://runtime.lex.af-south-1.amazonaws.com/bot/BotName/alias/BotAlias/user/UserID/text"", "errorType":"EndpointConnectionError",
我的lambda函数具有以下权限: AmazonLexFullAccess AmazonLexRunBotsOnly
我的Lex机器人拥有基本的Amazon Lex权限.