3
votes

I am able to create Amazon lex chat bot. I am also able to publish the same in Facebook messenger. Also I found sdk's for iOS and Android.

What I want is to publish lex bot as a webservice which can be called from any rest client, so that it can be integrated to any user interface with rest calls.

I heard of Javascript sdk's for publishing lex bots as service, but I am not able to find any proper documentation on this.

2

2 Answers

5
votes

The lex-runtime is accessible from the Javascript SDKs. AWS documentation is here: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html

The trickiest part is authentication. The recommendation from Amazon is usually to route your Lex requests through a Lambda function in front of an API gateway. An alternative is to have a Cognito unauthenticated role that has permissions to call Lex and then have the clients call it directly.

The getting started guide may be of use if you are unfamiliar with calling AWS from the browser: http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-started-browser.html

1
votes

You can use AWS API Gateway which will get the requests from your Rest Client and forward it to Lex.

Your architecture will be like:
Chat client <==> AWS API Gateway <==> AWS Lex

Check this link for details.