There has been talks since the early decades about robots taking over human centric jobs such as customer service staffs. Exacerbating the problem is the growing resentment of consumers towards outsourced customer support from major corporations.

A rekindled interest and technological improvement in Artificial Intelligence (AI) means that robots for customer support are hitting closer to home.

Introducing AI Chatbots. Chatbots can initiate talk, answer queries and understand different “intents” in different languages, act professionally and combine data analytics to discover consumer behavior insights.

The majority of the Baby boomers are nearing retirement and it’s the next generation of globalized people who are interacting with corporations’ customer support. These people, and many of them are Millennials, prefer text based conversation rather than audio conversation. There is not a better time than now to incorporate AI chatbots to your overall customer management strategy.

Let’s create a simple chatbot using 1) Dialogflow 2) MongoDB 3) Google Spreadsheets and 4) Heroku.

First, we sign up and login to Dialogflow. As you can see in the below screenshot, the first technical term to know in the chatbot world is “Intents”. Intent is user’s intention. For example, if user’s intent is to get the weather, then the intents are given a name, often a verb and a noun, such as “getWeather”. Intents play a pivotal role in AI chatbot development and gives the “cognition” to the chatbot.

Secondly, we need to create a new Dialogflow agent, let’s call it “2chatbots”

Lets now add an additional language for our potential Chinese clients by clicking on the cog icon, and going to Languages.

Dialogflow will create an application on Google Project with a Service Account. We can access this project in Google Cloud Console as well.

Click on the Project ID and it will redirect you to Google Cloud Platform.

Dialogflow will create a service account JSON key but since we cannot use it, we would have to create a new one.

Click on “Create credentials” -> “Service account key” -> “New service account” -> “Select a role”-> “Owner”-> ”JSON”.

Now we can go back to “API & Services” and go to “Library”. Choose “Google Sheets API” and enable it.

Now we switch gears and head on over to MongoDB. We will create a free sandbox account for our project on the mLab website.

Create a free sandbox account for our project on the mlab website, https://mlab.com/

Create a new user and password and add these credentials to the connection string in the Node.js backend. It is important to not use special characters like @, #, = for the credentials. Be sure to click on “Make read only” checkbox.

After creating new app on Heroku we have to add the environmental variables for our project.

EMAIL_LOG and EMAIL_PASS are the credentials from your Gmail agent.

SECRET is the mongoDB connection string. It should look like mongodb://<dbuser>:<dbpassword>@ds115244.mlab.com:15244/helppay.

SPREADSHEET is the id of the sheet taken from the address bar (part of the URL)

SESSION is the secret word to create session on the backend

PROJECT is the Dialogflow project ID

To publish your code on Heroku, we can use the following command:

Git init

Git status

Git add .

Git commit -m “1st commit”

Heroku login

Heroku git :remote -a name of your app

Git push heroku master

To connect Google spreadsheet to our project, we have to take the client email from the key.json file which we had downloaded from Google console and paste it to “share with others” input.

{
“type”: “service_account”,
“project_id”: “xxxxxxxxx”,
“private_key_id”: “xxxxxxxxxxxxxxxxxx5TcIig==\n—–END PRIVATE KEY—–\n”, “client_email”: “service@lqwerty-12345.iam.gserviceaccount.com”, “client_id”: “1xxxxxxxxxxxxxxxxxxxxxxx”,

“auth_uri”: “https://accounts.google.com/o/oauth2/auth”,
“token_uri”: “https://accounts.google.com/o/oauth2/token”, “auth_provider_x509_cert_url”: “https://www.googleapis.com/oauth2/v1/certs”, “client_x509_cert_url”:

“https://www.googleapis.com/robot/v1/metadata/x509/xxxxxx.iam.gserviceaccount.com “