In this exercise you will learn how to add conversation abilities to the bot to guide the user to create a help desk ticket.
Inside these folders for either C# or Node.js you will find a solution with the code that results from completing the steps in this exercise. You can use this solution as guidance if you need additional help as you work through this exercise.
To successfully complete this exercise, your bot must be able to perform the following tasks:
- Inform the user the current capabilities of the bot
- Ask the user for information about the problem
- Create an in-memory API to store ticket information
Here is a sample converastion with the bot:
- You must have either completed the prior exercise, or you can use the starting point provided for either C# or Node.js.
- A code editor like Visual Studio Code (for Node.js), or Visual Studio 2017 Community or higher for C#
Whenever you create a bot you need to ensure the user knows what options are available to them. This is especially important when working in a conversational based interface, where the user tells the bot what she'd like the bot to do.
The trouble ticket needs to store the following information:
- Severity
- High
- Normal
- Low
- Category
- Software
- Hardware
- Networking
- Security
- Description
The order in which the bot collects the information is up to you. You can use:
- A waterfall pattern for the conversation flow
Prompts.choice()
andPrompts.text()
to prompt for the severity and category of the ticket.Prompts.confirm()
to confirm that the ticket information is correct.
Using either Restify for Node.js, or Web API for C#, create a basic HTTP endpoint to store tickets in memory. The endpoint should accept POST calls with the ticket as the body of the message.
For purposes of this exercise, no database or other eternal datastore is needed; simply store the data in an array or list. The endpoint should be part of the same web application that hosts your bot.
NOTE: When deploying your application to production, you may decide to separate your endpoint in a separate application. Typically you will be calling existing APIs.
You can also use an Adaptive Cards to show the ticket details.
- For Node.js you can use the ticket.json file from the assets folder of the hands-on lab.
- For C#, you can use the Microsoft.AdaptiveCards NuGet package.
If you want to continue working on your own you can try with these tasks:
- Send a welcome message to the bot relying on the conversationUpdate event, as explained in the C# and Node version.
- Send a typing indicator to the bot while it calls the Tickets API, as explained in the C# and Node version.
- Update the data store for the trouble tickets to use a database, such as SQL Server, MongoDB, or Cosmos DB.