I can able to send the text to my lambda function from lex bot and getting the response. But how to send the voice from bot to lambda and getting a response in voice or text format. Please suggest.
Asked
Active
Viewed 136 times
2 Answers
0
The following blog written by AWS engineering team will definitely by helpful to address your problem.
https://aws.amazon.com/blogs/machine-learning/capturing-voice-input-in-a-browser/

Jaya Prakash Kommu
- 191
- 1
- 5
0
Following lambda function code returns voice from Bot.
`public Object handleRequest(Map<String,Object> input, Context context) {
context.getLogger().log("input" +input);
LexRequest lexRequest = LexRequestFactory.createLexRequest(input);
String content = String.format("<speak>Hi! Request came from:"+lexRequest.getBotName()+"</speak>",
lexRequest.getIntentName(),lexRequest.getCrust(),lexRequest.getPizzaKind(),lexRequest.getSize()
);
SessionAttributes sessionAttributes = new SessionAttributes();
Message message = new Message("SSML",content);
DialogAction dialogAction = new DialogAction("Close", "Fulfilled", message);
return new LexRespond(sessionAttributes,dialogAction);
}`

veera
- 317
- 2
- 3
- 14