aws lex bot api

0

when I tried to deal with aws lex bot api, I created a bot using aws console and it's wokring fine and face no probelm; but when I tried to use the aws api I got this error : { "message": "INVALID_REQUEST - Invalid bot name or alias" } I used this params into my api : https://runtime.lex.us-east-1.amazonaws.com/bot/botname/alias/aliasname/user/useid/text

I want to know if the probelm is related to the bot verison ? the botname and the aliasname are correct

2 Answers
1
Accepted Answer

Hi,

Looks like you are not using Lex V2 endpoint (https://runtime-v2-lex.us-east-1.amazonaws.com/bot/botname/alias/aliasname/user/userid/text) as expected. In order to access Lex V2 Recognize Text API, you need to send a post request to the endpoint https://runtime-v2-lex.us-east-1.amazonaws.com//bots/botId/botAliases/botAliasId/botLocales/localeId/sessions/sessionId/text. I would recommend following this documentation closely to hit RecognizeText API through postman or any other http client.

Another option is to AWS CLI.

Sample command to hit RecognizeText API

aws lexv2-runtime recognize-text --bot-id “7TBXBYVXOE” --bot-alias-id “TSTALIASID” --locale-id “en_US” --session-id “test_123” --region us-east-1 --text “book hotel”

Related AWS CLI documentation can be found here

AWS
Satish
answered a year ago
  • thanks so much, your response is the correct one

0

Hi,

One possibility is you may have created the bot using Lex V2 console which is the default interface for creating bots. And you are trying to access this bot through Lex V1 runtime APIs (https://runtime.lex.us-east-1.amazonaws.com/bot/botname/alias/aliasname/user/useid/text). Can you please try using Lex V2 runtime endpoint as documented here.

AWS
Satish
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions