Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lex Bot Integration with Rest Api

Is there any reference to connect lex bot with my rest api project?, i want to get pricing from my products , this enpoint is included in my project in a rest method (json request and response), however, I have tried to find any reference to call my rest api but I cant find any example.

The bot is using lambda function (nodejs), I am just beginning with amazon lex so I do not have any reference, I'm trying to modify the existing examples they provide (pizza ordering) but no idea by the moment!

Thanks in advance!

like image 247
DuSant Avatar asked Nov 15 '18 04:11

DuSant


1 Answers

You can send messages to Lex from your endpoint using PostText or PostContent of the Lex SDK.

But after Lex processes the input, you can only either allow Lex to create the response and respond to the sender, or pass the Lex Event to Lambda for validation and parsing (the better option for more control).

So to pass the Lex Event to your endpoint, simply use the Lambda function.

You can use Request module or the default http or https of Node.js.

You can find a good answer on how to do that here: How to make remote REST call inside Node.js? any CURL?

like image 178
Jay A. Little Avatar answered Oct 26 '22 19:10

Jay A. Little