You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Slack表单创建及同步生成Jira工单的实现方法咨询

Slack表单提交自动创建Jira工单的实现方案

Hey there! Let’s break down exactly how to build that Slack form with text inputs, radio buttons, checkboxes, and dropdowns that triggers a Jira ticket on submission. I’ll cover two approaches to fit different needs—one quick no-code option, and a custom dev route for full control.

方案一:用Slack Workflow Builder(快速上手,无需编码)

If you’re looking for a fast, code-free setup, Slack’s Workflow Builder integrates directly with Jira, making this super straightforward.

步骤1:创建新Workflow

  • Open Slack, click the + icon in the bottom left → select Workflow Builder → hit Create
  • Pick your trigger: Go with "From a link" to share a form link in channels, or "From a button in a message" to add a form trigger to existing messages.

步骤2:搭建你的表单

Add an Ask in a modal step—this is where you’ll build your form with all the components you need:

  • Text boxes: Choose "Short answer" (for titles, quick inputs) or "Long answer" (for detailed descriptions). Name each field (e.g., "Ticket Title") and set a variable name (like ticket_title) to reuse the data later.
  • Radio buttons: Select "Multiple choice - single select" to add mutually exclusive options (e.g., Priority: High/Medium/Low).
  • Checkboxes: Use "Multiple choice - multiple select" for multi-select options (e.g., Associated Modules: User Management/Payment System).
  • Dropdown list: Pick the "Dropdown" field type for a clean, compact select menu (e.g., Issue Type: Bug/Feature Request/Support Ticket).

步骤3:连接Jira并映射字段

  • Add a new step, search for Create Jira issue. If you haven’t connected Slack and Jira yet, follow the prompts to authorize your Jira account (you’ll need permissions to create tickets in your Jira project).
  • Map your Slack form variables to Jira fields: For example, link ticket_title to Jira’s "Summary", ticket_description to "Description", your radio button priority to Jira’s "Priority" field, checkboxes to Jira labels, and the dropdown to "Issue Type".

步骤4:测试并发布

  • Hit Test to simulate a form submission and verify the Jira ticket gets created correctly.
  • Once everything checks out, click Publish and share your form link or button with your team!

方案二:自定义Slack App + Jira API(完全定制化)

If you need dynamic form fields, custom validation, or integration with other tools, building a custom Slack App with Jira’s REST API gives you full control.

步骤1:Set Up Your Slack App

  1. Head to the Slack Developer Platform, create a new app "From scratch", and link it to your workspace.
  2. Enable Interactivity & Shortcuts: Toggle it on, then set a Request URL (this is your backend server’s endpoint that will handle Slack’s form submission requests).
  3. Add a Slash Command (optional): Create a command like /create-ticket so users can trigger the form by typing it in Slack.
  4. Configure OAuth Permissions: Add scopes like commands, chat:write, and users:read, then install the app to your workspace to get your Bot Token.

步骤2:Build the Form Modal

When a user triggers the slash command or a button, your backend will send a modal payload to Slack. Here’s a sample JSON snippet for the modal with all your desired components:

{
  "type": "modal",
  "callback_id": "create_jira_ticket_modal",
  "title": { "type": "plain_text", "text": "Create Jira Ticket" },
  "submit": { "type": "plain_text", "text": "Submit" },
  "blocks": [
    {
      "type": "input",
      "block_id": "title_block",
      "label": { "type": "plain_text", "text": "Ticket Title" },
      "element": {
        "type": "plain_text_input",
        "action_id": "ticket_title",
        "placeholder": { "type": "plain_text", "text": "Enter a clear title" }
      }
    },
    {
      "type": "input",
      "block_id": "priority_block",
      "label": { "type": "plain_text", "text": "Priority" },
      "element": {
        "type": "radio_buttons",
        "action_id": "priority",
        "options": [
          { "text": { "type": "plain_text", "text": "High" }, "value": "High" },
          { "text": { "type": "plain_text", "text": "Medium" }, "value": "Medium" },
          { "text": { "type": "plain_text", "text": "Low" }, "value": "Low" }
        ]
      }
    },
    // Add checkboxes, dropdowns, and other fields here following the same pattern
  ]
}

步骤3:Handle Form Submission & Call Jira API

When the user submits the form, Slack will POST the form data to your Request URL. Your backend needs to:

  1. Parse the payload to extract form values (look in payload.state.values for each field’s data).
  2. Call Jira’s REST API to create the ticket. Use the endpoint https://your-jira-instance.atlassian.net/rest/api/3/issue with an API Token (generate one in your Atlassian account settings) for authentication.

Sample Jira API request body:

{
  "fields": {
    "project": { "key": "PROJ" }, // Replace with your Jira project key
    "summary": "Sample Ticket Title", // Pulled from Slack form
    "description": {
      "type": "doc",
      "version": 1,
      "content": [
        {
          "type": "paragraph",
          "content": [{ "type": "text", "text": "Detailed issue description from Slack" }]
        }
      ]
    },
    "issuetype": { "name": "Bug" }, // From Slack dropdown
    "priority": { "name": "High" }, // From Slack radio buttons
    "labels": ["User Management", "Payment System"] // From Slack checkboxes
  }
}

步骤4:Send Feedback to the User

After creating the Jira ticket, send a confirmation message back to the user in Slack—include the ticket link so they can jump right to it.

Key Tips to Avoid Headaches

  • Permissions: Make sure your Slack App has workspace access, and your Jira account has permission to create tickets in the target project.
  • Field Mapping: Jira’s field IDs/names can vary by instance—use Jira’s /rest/api/3/field endpoint to list all fields and confirm your mappings are correct.
  • Error Handling: Add logic to catch failed Jira API calls or invalid form inputs, and notify the user or admin accordingly.

内容的提问来源于stack exchange,提问作者Lior H

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:42:26