Building A Chat Bot (Version 1)

I spent a large portion of my IT career working as a 1st line support technician. With my growth in coding skills and with technology expanding I’ve begun to ponder if some of the role of a 1st line technician can be automated via a bot.

So….here I go!

First off, I’m going to be using node.js and building my bot within a Windows 10 environment. I’m going to be starting simple and building on my results (think big, start small). The basic details that a 1st line support tech has to get are: name, location, contact details, device details and details of the fault.

For my initial bot I just want to test collecting the details and some very basic interaction with the user. The bot will be run locally on my computer.

I’ve installed node.js from: and followed the quick start guide that Microsoft provides here: and I’ve also installed the Bot Framework Channel Emulator from:

Here is the code I’ve got so far:

var restify = require(‘restify’);
var builder = require(‘botbuilder’);

// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log(‘%s listening to %s’,, server.url);

// Create chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD

// Listen for messages from users‘/api/messages’, connector.listen());

var bot = new builder.UniversalBot(connector, [
function (session) {
session.send(“Welcome to the online IT Help Desk. I’m a simple bot that will take your details to log an IT call for you”);
builder.Prompts.text(session, “Please can I take your full name (e.g. John Smith)”);

function (session, results) {
session.dialogData.custname = results.response;
session.send(`Hi ${session.dialogData.custname}`)
builder.Prompts.text(session, “What is the asset tag or serial number of your device?”);
function (session, results) {
session.dialogData.tagref = results.response;
builder.Prompts.text(session, “Please supply a contact telephone number that IT can ring you back on”);

function (session, results) {
session.dialogData.contactnumber = results.response;
builder.Prompts.text(session, “And where are you based (e.g. Room 1, Floor 2, Big Company House). Please be as specific as possible”);

function (session, results) {
session.dialogData.location = results.response;
builder.Prompts.text(session, “Finally, please write a few lines to describe the problem you are experiencing.”);
function (session, results) {
session.dialogData.comments = results.response;

session.send(`I’ve created an IT call for you. Just to confirm, here are the details you gave me: <br/>Call details: <br/>Name: ${session.dialogData.custname} <br/>Asset Tag: ${session.dialogData.tagref} <br/>Contact Number: ${session.dialogData.contactnumber} <br/>Location: ${session.dialogData.location} <br/>Description of issue: ${session.dialogData.comments}`);

The bot awaits for a connection message, greets the user and then takes some details before showing them the user. No small talk (yet) and it is still very basic, plus I will need to figure out how to export the results to a database.


2 thoughts on “Building A Chat Bot (Version 1)

Comments are closed.