Go to Slack

Slash Command with an actionable message

Use cases:
  • Initiate actions in external systems from Slack
  • Kick-off Slack-based workflows
Works with:
  • Slash commands
  • Message Buttons
Code samples:

Allow people in Slack to create a helpdesk ticket in a 3rd party system using a Slash Command. Once the ticket is created, send an interactive message into Slack allowing the user to set a priority.

This app blueprint assumes you're able to create tickets in your 3rd party system programatically.

How it works

1. Receive Slash Command events from Slack

When a user executes the Slash Command associated with the app (e.g. /helpdesk [description of issue], Slack will send a POST request to the Slash Command request URL provided in the app settings. This request will include the text sent along with the Slash Command, a response_url, and information about the user who took the action.

2. Create helpdesk ticket

The app will leverage your ticketing system's API to create a ticket on behalf of the user who executed the Slash Command. You can either map users based on email address or use the account binding blueprint to ensure that all existing authorizations are well respected. Once the ticket has been created, a status update can be sent back to Slack using the response_url. The response_url allows the app to send an ephemeral message to the user using an HTTP request with a JSON payload. In the message we'll include a callback_id and a message menu with a list of priorities. The callback_id should map to the ID of the newly created ticket. This will help us map any interactive message events back to a specific ticket.

3. Handle interactive message events

If the user clicks on a button or makes a selection from a menu in the ephemeral message, Slack will send a POST request to the Interactive Message request URL provided in the app settings. This request will include a callback_id, a response_url and information about the user who took the action. The callback_id (which was previously set to be the same as the ticket ID) can be used to map the action back to a specific ticket. The app will leverage your ticketing system's API to make the necessary updates. Once the update has completed, a status update can be sent back to Slack using the response_url. The response_url allows the app to update the content of the message the action was taken on using an HTTP request with a JSON payload.

Diagram

A flow diagram detailing actionable slash command

Related documentation