Integrated Bot with Server less Application

Introduction

We will discuss about the capabilities of few AWS components to build an simple Server Less Application with an customized BOT integrated within the application.

We will be present with the configuration Amazon Lex and how to create a Customized Interactive BOT embedded inside the Website.

Other Components which are used in the architecture.

  • S3
  • Lambda
  • API Gateway
  • DynamoDB
  • CloudWatch
  • Cloud Formation

There are inline AJAX Rest Invocation present in the HTML Pages to make the website responsive and orchestrate the responses.

Architecture

Let’s look at the high level architecture. The Website is an simple portal to add various tasks for an user incorporating the type , timeline and complexity of the tasks. There is an help service inside the website which based on some pre-configured instructions and gives the end intent.

We have uploaded the User Credentials inside the DynamoDB (Database As a Service). When then user logs inside the portal after entering valid credentails. They are able to create new tasks inside the portal which gets saved in the database for further processing inside the bot.

Implementation

Server Less Web Application

Here we have a simple HTML invoking the end point exposed by API Gateway. The data’s are also manipulated and validated in Lambda which connects with the DynamoDB in the backend.

In the above diagram, We have shown the API which connects to the lambda and produces a simple but end-to-end Server Less Web Application which basic CRUD functionalities done by lambda with database.The user will be able to add the tasks in the 2nd page of the application where the previously added tasks are also displayed.

User can enter all the details which is shown in the above diagram and these details are stored in the DynamoDB across multiple tables as per the directions implemented inside the Lambda.

Customized BOT

We have an embedded UI inside the web application which interacts which the REST API exposed by API Gateway(Different End Point this time) and creates a continuing conversation scenario.

In the Right Side of the Application, We can see that there is an Simple Interactive Chat Window which does a Conversation with the end user and derives the final result after doing the backend validation by lambda and Lex.

We have designed the Amazon Lex to produce a rest based API to incorporate all the incoming values and construct a complete JSON Request which will be executed by Lambda and fetch the result from the back end.

We also denote the Intents andn Fulfillment of the Bot inside the console of the Lex of AWS . There is also an Seperate API Based Invocation which can be used to create more Intents and Validations of the Lex. We can check more of the details in the official documentation of Lex.

API Gateway is also one of the Integral part of the solution. We have separate endpoints with various methods(PUT,POST,GET) for each of the endpoints which are catering the whole solution.

In the below diagram, you can see there are many methods for each of the endpoints and each of the endpoints are connected to various Lambda for performing a single independent functions.

Conclusion

Finally, we are done!

We can also create a CloudFormation Template for automating all the configurations which needs to be done and can have a dedicated stack(not in scope of this post). The bot embedded inside the application can also be exposed through different messaging channels like slack, SMS etc.


This Slack Configuration is just an One time Authentication Setup and creating a app inside any workspace of Slack.

References

Be the first to comment

Leave a Reply

Your email address will not be published.


*