Tutorial: Build an Employee Help Desk Ticketing System
Tags: python, tutorial, database
Published: 2020-04-21 12:38:35

*This tutorial is a bit more advanced then some of our previous tutorials using WayScript. It's a great tutorial which combines working with databases, python and HTTP triggers and requests to create a simple ticketing system. Reach out to us if you have questions.*

##Introduction
Having and using the right software for your internal business applications is important. A few tedious tasks in your workflow can scale to affect hundreds of people later on. With WayScript, you can build the ideal internal business software while still having control to fully customize every aspect, preventing headaches later on. In this tutorial, let's work through how we could develop an internal help desk ticketing system using WayScript.

##Prerequisites
No prerequisites but some content you might find helpful:
[Working with Databases](https://docs.wayscript.com/library/modules/sql)
[Working with Python](https://docs.wayscript.com/library/modules/python)
[Working with HTTP Triggers](https://docs.wayscript.com/library/triggers/http-trigger)
[Working with HTTP Responses](https://docs.wayscript.com/library/modules/http-response)

##Requirements
For this build, let's say we need to create a couple different functionalities:
-Submitting a ticket
-Notification of ticket submit
-Way to resolve tickets

Let's walk through how we can build each of these requirements.

##Submitting a Ticket
For a user to submit a help desk ticket, they'll need to have access to a form. To create this form using WayScript, there's two options. One way we can do this is by using our prebuilt [forms trigger](https://docs.wayscript.com/library/triggers/form-trigger). This provides a fully customizable form, hosted at a url, all combined into one module. This module can pass the information gathered to the rest of your workflow within the editor.

The second option, allowing the developer more control, is to create the HTTP trigger, HTTP response, and HTML & CSS content they want to serve themselves. This is what we'll use in this tutorial to allow easier customizations.

To do this, your workflow would look something like this:

![workflow](https://cdn.wayscript.com/blog_img/78/1.png)

Let's break this down to describe what's happening here. Triggers in WayScript start the actions below them whenever they're triggered. A HTTP trigger begins the workflow upon a user visiting the URL. The data that we will pass as the final HTTP response to the user visiting that URL, comes between the HTTP trigger and the HTTP response. We're constructing the webpage using HTML, CSS, and the images modules.

Each module can receive inputs from the previous module and pass outputs to the next module. So in the construction of our script, we create a CSS and images output, then supply that to the HTML module. From here, we pass this html output to the HTTP response to render the webpage upon visit. If you'd like to view this html form yourself, you can find it here.

##Notification of Ticket Submit
Once the ticket has been submitted, we'll need a way to notify those who need to resolve the help desk tickets. This can be done through a variety of different of mediums. Like anything else with WayScript, if the prebuilt module isn't there, you're able to build it yourself using programming language modules or contact us to build it for you. Some of the current notifications channels are slack notifications and emails among others. Let's send this provided information as an email.

To send your collected information as an email, your workflow might look something like this:

![SMTP Email](https://cdn.wayscript.com/blog_img/78/2.png)

We can take the variables created from the form output and pass them as the parameters of the email to be sent. Opening up the customization of the email:

![Email customization](https://cdn.wayscript.com/blog_img/78/3.png)

##Resolving Tickets
By asking the user to provide an email, we can resolve tickets directly from our inbox. However, if you wanted to build a more elaborate system involving a database, you could. WayScript provides an SQL module which can read and write to sql based databases. Using this, we could build a full fledged database table, allowing only certain users to flag tickets as resolved or not. An example of this workflow may look something like this:

![workflow](https://cdn.wayscript.com/blog_img/78/5.png)

Here we have two separate http triggers and html responses with database actions in between. The first webpage could be used to view current open tickets, while the second webpage can be used to write closed flags.