We use Zendesk to help manage internal support requests that the IT operations team handles internally. Zendesk provides multiple methods (or channels) to submit requests, such as e-mail and the Zendesk Guide (Help Center). However, most internal communication with the IT operations team now occurs via Slack. In order to make submitting requests easier, I crafted a Slack app to service slash commands as a way to submit support requests. This post describes the application, explains some key points of operation, and releases the source on GitHub.
The application follows this basic workflow:
- A user types
- Slack presents a dialog asking for more details, such as a description, issue type, and priority.
- The user clicks “Submit.”
- Zendesk creates a new ticket, attributed to the user who ran the slash command, along with all provided details.
- Slack notifies the user of the successful creation of the ticket, including useful details such as the ID and a link to the ticket in Zendesk.
Generally, the application operates as follows:
- The slash command (
/support) is configured in Slack to send an HTTP POST to the application, along with any provided parameters such as an issue description.
- The application, in turn, sends an HTTP POST to the Slack dialog API requesting that a dialog with specific labels and input fields be opened.
- Upon user submission, Slack sends the input field data (and other metadata, such as user ID) to the application via an HTTP POST to a specific URL for interactive components.
- The application uses the data from the Slack API to look up the e-mail address of the user submitting the issue.
- The application uses the e-mail address of the user to look up the Zendesk user ID of the associated user.
- The application creates a new ticket via HTTP POST to the Zendesk API, using the retrieved user ID as the requester, and incorporating all data relevant to the issue.
- The application sends an HTTP POST to the Slack chat API to request a message be sent to the user as a Slack bot. This message includes a summary, along with details from creating the Zendesk ticket.
The overall flow of the application is very straightforward, allowed by important assumptions in the configuration of our Slack team and Zendesk workspace:
- The e-mail address of a user in Slack will always correspond exactly with the e-mail address of an end user in Zendesk.
- Users in Slack already have a corresponding end user in Zendesk.
The application was specifically tailored to run on Heroku, but it could easily be adapted to run anywhere. Some important configurations are required on the Slack side (registering the application, the slash command, and interactive components), and in environment variables for the application (endpoints, credentials, etc.).