Accounts Payable Bot using Azure Bot Service
Active Azure Subscription
Install Visual Studio Code
Install nodejs 8.11
Install Bot Framework Emulator
Note: Creating the web app bot in Azure also creates an AAD App. If you do not have access to create apps in AAD you can ask your administrator to create a Converged Application at apps.dev.microsoft.com and add you as Owner. Once you are added as owner, you can generate a new password and use it while creating the web app bot
Application Settings
and copy values for MicrosoftAppId
,MicrosoftAppPassword
,LuisAppId
andLuisAPIKey
and update it in the web\sample.env
file.Note: If you have created the Web App Bot the LUIS app will be created for you automatically.
My Apps
click the app that was created.luis-model\contosoapbot.json
file.Settings
tab, click on Import new version
and upload the luis-model\contosoapbot.json
file.Train Button
to train the updated model.Publish
tab, click on Publish
button to publish the model to both Production and Staging. requests
Shared access policies
, click on RootManageSharedAccessKey
and copy value for Primary Connection String
.ServiceBusConnectionString
in web\sample.env
and console\sample.env
files.Analytics DB
web\analytics\dbscript.sql
.SqlAnalyticsConnectionString
in web\sample.env
file.Invoice DB
ContosoEdw
.console\dbscript\localdb.sql
.sqledwConnectionString
in console\sample.env
file.Copy dev instance url
, password
and update ServiceNowUrl
, ServiceNowPassword
in web\sample.env
file.
Note: While testing you can click on Incidents
to see the new tickets created by the Bot
Rename web\sample.env
, console\sample.env
to .env
Start Bot Web App
cd web
npm install
npm start
Start Bot Request Processor Job
cd console
npm install
npm start
Start Bot Emulator
Endpoint Url : http://localhost:3978/api/messages
Microsoft App ID: [Use MicrosoftAppId from .env file]
Microsoft App Password: [Use MicrosoftAppPassword from .env file]
Type Hi
in the bot emulator, it should return the text from the Greeting Dialog
Test bot processor job integration using below sentences, you can always type help
to get more details:
what is the payment status for invoice number 11001 and vendor Contoso Inc
what is the status for po number 11001
Invoice Copy - could I have a copy of invoice 11001 from vendor Contoso Inc
To Test Servicenow, log in to the dev intance and click on Incidents
to see the tickets created/updated by the Bot

- Servicenow tickets are created for each conversation session and the entire history of the conversation is saved under activities.
- The Ticket ID is updated based on the human handoff response.
Update Application Settings
Application Settings
under Bot Service and add all environment variables from web\.env
file.WEBSITE_NODE_DEFAULT_VERSION
and value=8.11.1
Update Nodejs version
Build
in Bot Service click on Open online code editor
.iisnode.yml
file to point the nodeProcessCommandLine to 8.11.1 path nodeProcessCommandLine: "D:\Program Files (x86)\nodejs\6.9.1\node.exe"
Deploy Code
web
folder into the wwwroot
folder on Azure. (Do not copy .env
file and node_modules
folder)Build
in Bot Service click on Open online code editor
.Open Console
button and run npm install
to install all the dependencies.