Omnichannel Product Using AWS Services

Sunny Agrawal
7 min readAug 13, 2021

Hello Guys,
My name is Sunny Agrawal and I hope you all are doing well.

Today I am going to share my internship experience with you guys.
This Summer, I have joined Scale Capacity Inc. as an intern. This was my first internship and I was happy that I got to work there. By this internship, I have gained invaluable experience that will help me with my carrier.
Due to current situation I had gone through this internship remotely from my home but despite of that I really enjoyed working there.

In this internship, I worked on Omnichannel product using Alexa, Amazon Connect and Amazon Lex or an overview of the areas where I worked in this project over the time of two months:
Firstly I started working on Amazon Lex and then I was given task of designing the database. Later I created the API’s for database manipulation and lastly I worked on the frontend development using React JS.
Let’s see all of this in a brief.

Working with Amazon Lex

At the start of Internship, I choose to work with Amazon Lex as I have never worked with it and wanted to explore it. Amazon Lex is an AWS service for building conversational interfaces for applications using voice and text.
For getting familiar with the working of Amazon Lex, I started by creating a sample coffee order bot by following documentation provided in a Github Repo. By creating this bot, I tried to understand many different aspects of Amazon Lex like How to create intent, slots and utterances, How we can use Lambda functions for validating user’s input and for intent fulfillment, How to define user request and responses for lambda function and How to publish a bot for integrating it with various use cases. Amazon Lex really makes it easy for creating a chat/voice bot.

Sample Amazon Lex Use Case

In this project, We will be integrating this lex bot with Amazon Connect and for getting familiar with this use case I followed a sample template through which I can get an idea of what we will be building. Amazon Connect is a self-service, cloud-based contact center service that makes it easy for any business to deliver better customer service at lower cost. And it is very easy to integrate Amazon Connect with Amazon Lex. We just need to publish the lex bot and add it in the Amazon Connects contact flow.

The concept of this project is creating a omnichannel product where the customer calls Amazon Connect number which connect them to an Lex bot and which behind the scene invokes lambda function based on an intent from Lex.

Follow this blog for creating your own Lex bot with Connect integration

Similar use case guide

Database design and Backend development

AWS provides many different options for database that we can use as per our requirements. As per our use case, a NoSQL database is required and DynamoDB is our ideal choice. Before we can start creating the tables that we require in our database, we need to first design our database.

A good database design is important in ensuring consistent data, elimination of data redundancy, efficient execution of queries and high performance application. Taking the time to design a database saves time and frustration during development, and a well-designed database ensures ease of access and retrieval of information.

A NoSQL database does not require all of the fields predefined as it is schemaless but planning this ahead of time will take less time and will be more efficient when implementing. While creating the tables in our database we need to define the partition key which will be unique and used to retrieve information or if we have a little complex table that is identifying an object with only partition key is not sufficient than we have another possibility of creating a partition key and sort key structure where partition key can be repeated but sort key needs to be unique.

Developing and deploying all of the resources through console will create a little overhead and the whole product can not be shared with customers. Instead of doing this from management console, we have used serverless framework. The Serverless Framework makes it easy to develop, deploy, troubleshoot and secure your serverless applications with radically less overhead and cost. For developing and deploying resources, we just need to create a serverless.yml file which will be a configuration file containing all of the necessary information that are needed for creating the resources in AWS.
In the backend development, I have created lambda functions using serverless framework which are going to be used for manipulating the data in the database like getting particular data from database or putting data of a customer from frontend through API calls.

Sample code snippet for creating lambda function

Quick explanation of how to create Lambda functions using Serverless framework. In serverless.yml a lambda function can be created by mentioning the function name where the code of function is written and is deployed based on the path you provide in events. Optionally you can set extra parameters if required in api gateway url like query strings or headers.

This lambda function will be called using rest APIs that are again called from our business logic. The different APIs required for each table and each action like GET, POST and UPDATE. For mapping particular user record in backend and frontend, we can pass id in url parameter so the function can fetch and update particular user record without affecting other users data. Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. APIs act as the “front door” for applications to access data, business logic, or functionality from your backend services.

The Lambda function that are used for working with database are created in Node.js by using the JavaScript API for DynamoDB. Its easy to understand and implement the function you can do it by following the below documentation.
For more information on how to create a function in node.js follow this documentation.

Frontend Development

In the project, Frontend is a part on which whole use case is depended. The main idea here is that when a user wants to use the product he/she needs to register on the web application. Due to this step it becomes easy to gather user’s data that will be required for the use case and also gives a kind of platform for managing the product.

Personally I didn’t have very good experience with frontend and more of it I have never worked with React JS so this was a challenge for me and I am happy that I gave it a try. Starting my journey in frontend development, it was little difficult at first because I need to learn few basic things before starting but as time went I gradually got experience working with it like how we can create separate pages in react and then integrate them with main flow according to our needs and how we can call APIs and use it for getting data from backend and show it to the user in a user friendly manner and how we can send data by calling POST APIs and store data in database.

Before we can start working on frontend, We need to understand the requirements and the flow of the whole web application so that we can get an idea of what things, functionalities and features are required and what will be the flow of the web application.
When we need to share our backend resources with the customers we will be serving, a sign up/sign in functionality is most important and kind of gives a way to manage or map the user with backend database. For this, I have used Amazon Cognito which provides authentication, authorization, and user management for your web and mobile apps. Your users can sign in directly with a user name and password, or through a third party such as Facebook, Amazon, Google or Apple. Its same as a user sign up through any regular website but the functionality is in backend so that we don’t need manage any server that will be up and running 24*7 for verifying new users. User will be using a email for sign up and a verification code will be sent to them through which cognito can verify user authenticity.

The basic use case of the web application will be of providing a interface for the user through which they can register and order products by calling the connect phone number and the merchants will be able to manage their product by adding new product or managing current products information.

For creating the whole web application, I have been following many different documents and used different node packages like for creating forms and dynamic navigation bar I have used react bootstrap, for form validation I have used formik and yup, for calling Rest APIs I have used axios and so on.
I am not going very deep in the frontend. But if you have anything in mind you can surely let us know in the comments.

Thank you for giving your time reading this blog.
If you enjoyed reading the blog leave us a like 💙 and follow us for more !

Writer: Sunny Agrawal
LinkedIn Profile: