Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Amadei committed Feb 26, 2019
0 parents commit 9fdbefb
Show file tree
Hide file tree
Showing 72 changed files with 14,589 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ServiceDeskSampleBot
Sample Service Desk Bot

This bot has been created using Bot Framework, it shows how to create a bot capable of performing Service Desk tasks.

Follow the steps [here](./mock_services/ticket-dummy-service) to deploy the supporting services.

Follow the steps [here](./bot/service-desk-sample-bot) to deploy the Bot.
11 changes: 11 additions & 0 deletions bot/service-desk-sample-bot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
lib
.env
.luisrc
.qnamakerrc
cognitiveModels
data
*.dispatch
*.bot
publish
publish.cmd
24 changes: 24 additions & 0 deletions bot/service-desk-sample-bot/PREREQUISITES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Azure Deployment Prerequisites
This bot has prerequisite requirements in order to deploy the bot to Azure.

This document will enumerate the required prerequisites and show how to install them.

## Overview
There are a small set of CLI tools that will automate the process of deploying this bot to Azure. These CLI tools are only require for deployment. If you only plan to run the bot locally, these prerequisites are not required.

## Prerequisites
- If you don't have an Azure subscription, create a [free account][5].
- Install the latest version of the [Azure CLI][6] tool. Version 2.0.54 or higher.
- Install latest version of the `MSBot` CLI tool. Version 4.3.2 or higher.
```bash
# install msbot CLI tool
npm install -g msbot
```

[Return to README.md][3]


[3]: ./README.md
[4]: https://nodejs.org
[5]: https://azure.microsoft.com/free/
[6]: https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest
119 changes: 119 additions & 0 deletions bot/service-desk-sample-bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# ServiceDeskSampleBot
Sample Service Desk Bot

This bot has been created using [Bot Framework][1], it shows how to create a bot capable of performing Service Desk tasks.

## Prerequisites
- [Node.js][4] version 8.5 or higher
```bash
# determine node version
node --version
```

# To run the bot locally
- Create a .env file locally with the following contents:
```
botFilePath="ServiceDeskSampleBot.bot"
botFileSecret="<SECRET USED TO ENCRYPT THE BOT FILE>"
PWD_RESET_TENANT_ID="<Tenant of the directory where the bot is able to reset passwords>"
PWD_RESET_APP_ID="<App ID of the service principal created in the directory where the bot is able to reset passwords> (**)"
PWD_RESET_APP_SECRET="<Secret of the service principal created in the directory where the bot is able to reset passwords> (**)"
PWD_RESET_AAD_URL="https://graph.windows.net"
PWD_RESET_GRAPH_API_VERSION="1.6"
TICKET_SERVICE_BASE_URL="<URL of the Function deployed to act as the ticket service>"
TICKET_SERVICE_KEY="<Key of the Function deployed to act as the ticket service>"
OAUTH_CONFIG_NAME=Name of the OAuth Setting to authenticate the bot (***)
SMS_SERVICE_URL=<URL of the Logic App capable of sending SMS via Twilio> (****)
```
- (**) - Requires a Service Principal created and granted admin rights. Check the file powershell/grantAdmin.ps1 on how to add the proper roles.
- (***) - Requires a Bot Service in Azure and the proper configuration of the Bot App Id and App Secret. Recommended to deploy the bot to Azure following the procedures bellow and then the configuration of an OAuth Setting via the portal and configuration here.
- (****) - Requires the deployment of a logic app capable of sending messages via Twilio. Deployment procedure described [here].
- Install modules
```bash
npm install
```
- Start the bot
```bash
npm start
```

# Testing the bot using Bot Framework Emulator **v4**
[Bot Framework Emulator][5] is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

- Install the Bot Framework Emulator version 4.2.0 or greater from [here][6]

## Connect to the bot using Bot Framework Emulator **v4**
- Launch Bot Framework Emulator
- File -> Open Bot Configuration
- Navigate to `ServiceDeskSampleBot` folder
- Select `ServiceDeskSampleBot.bot` file

# Deploy the bot to Azure

## Prerequisites
- [Azure Deployment Prerequisites][41]

## Provision a Bot with Azure Bot Service
After creating the bot and testing it locally, you can deploy it to Azure to make it accessible from anywhere. To deploy your bot to Azure:

```bash
# login to Azure
az login
```

```bash
# provision Azure Bot Services resources to host your bot
msbot clone services --name "ServiceDeskSampleBot" --code-dir "." --location <azure region like eastus, westus, westus2 etc.> --sdkLanguage "Node" --folder deploymentScripts/msbotClone --verbose
```

After created the application, add the same application settings as the ones added in the .env to run locally as stated [here](#To-run-the-bot-locally) but this time the settings should be added to the application where the bot was deployed to in Azure.


## Publishing Changes to Azure Bot Service
As you make changes to your bot running locally, and want to deploy those change to Azure Bot Service, you can _publish_ those change using either `publish.cmd` if you are on Windows or `./publish` if you are on a non-Windows platform. The following is an example of publishing

```bash
# build the bot source code
npm run build
```

```bash
# run the publish helper (non-Windows) to update Azure Bot Service. Use publish.cmd if running on Windows
./publish
```

## Getting Additional Help with Deploying to Azure
To learn more about deploying a bot to Azure, see [Deploy your bot to Azure][40] for a complete list of deployment instructions.

# Further reading
- [Bot Framework Documentation][20]
- [Bot Basics][32]
- [Azure Bot Service Introduction][21]
- [Azure Bot Service Documentation][22]
- [Deploy Your Bot to Azure][40]
- [Azure CLI][7]
- [msbot CLI][9]
- [Azure Portal][10]
- [Language Understanding using LUIS][11]
- [TypeScript][2]
- [Restify][30]
- [dotenv][31]

[1]: https://dev.botframework.com
[2]: https://www.typescriptlang.org
[3]: https://www.typescriptlang.org/#download-links
[4]: https://nodejs.org
[5]: https://github.com/microsoft/botframework-emulator
[6]: https://github.com/Microsoft/BotFramework-Emulator/releases
[7]: https://docs.microsoft.com/cli/azure/?view=azure-cli-latest
[8]: https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest
[9]: https://github.com/Microsoft/botbuilder-tools/tree/master/packages/MSBot
[10]: https://portal.azure.com
[11]: https://www.luis.ai
[20]: https://docs.botframework.com
[21]: https://docs.microsoft.com/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0
[22]: https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0
[30]: https://www.npmjs.com/package/restify
[31]: https://www.npmjs.com/package/dotenv
[32]: https://docs.microsoft.com/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0
[40]: https://aka.ms/azuredeployment
Loading

0 comments on commit 9fdbefb

Please sign in to comment.