Quick Overview
This workflow turns a Slack slash-command request into an AI-drafted Jira ticket preview, then creates the Jira issue only after a user approves it in Slack using interactive buttons.
How it works
- Receives a Slack slash command via a webhook and immediately responds with an ephemeral acknowledgement message.
- Reads configuration values (message count, Jira project key/type, and Slack context) and fetches recent messages from the Slack channel using the Slack conversations.history API.
- Cleans and formats the Slack messages into a chronological transcript, returning an error payload if no usable messages are found.
- Sends the transcript to an OpenRouter chat model (via an n8n AI agent) to generate a structured Jira ticket draft JSON.
- Parses the draft JSON and posts an ephemeral Slack preview containing the proposed title, type, priority, description, acceptance criteria, and Approve/Cancel buttons.
- Receives the Slack button interaction via a second webhook, parses the interaction payload, and either creates a Jira issue or cancels the request.
- Updates the Slack preview message to confirm ticket creation or show a cancellation notice.
Setup
- Create a Slack app and configure the slash command request URL to point to the workflow’s slash-command webhook, and configure Interactivity to point to the workflow’s interaction webhook.
- Add Slack API credentials in n8n and ensure the bot has permission to read conversation history and post messages.
- Add an OpenRouter API credential and select the model you want to use for drafting the ticket.
- Add Jira Software Cloud credentials and set the target Jira project and issue type (and/or update the project key/type values in the workflow configuration).