{
  "name": "orboto: idea to ticket to done",
  "nodes": [
    {
      "id": "ca22e3a0-4397-4b87-aead-3ee312fa5b0b",
      "name": "Submit an Idea",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.6,
      "position": [
        -260,
        0
      ],
      "parameters": {
        "authentication": "none",
        "formTitle": "Submit an idea",
        "formDescription": "Drop a rough idea here. It becomes a tracked ticket you can follow all the way to done.",
        "formFields": {
          "values": [
            {
              "fieldName": "idea_title",
              "fieldLabel": "Idea title",
              "fieldType": "text",
              "placeholder": "One line - what is the idea?",
              "requiredField": true
            },
            {
              "fieldName": "idea_description",
              "fieldLabel": "Describe it",
              "fieldType": "textarea",
              "placeholder": "A few lines: what it is, who it is for, why now.",
              "requiredField": true
            },
            {
              "fieldName": "channel_or_link",
              "fieldLabel": "Channel or link (optional)",
              "fieldType": "text",
              "placeholder": "Where this came from - a video, a thread, a customer call",
              "requiredField": false
            }
          ]
        },
        "responseMode": "lastNode",
        "options": {
          "appendAttribution": false,
          "buttonLabel": "Send idea",
          "ignoreBots": true
        }
      }
    },
    {
      "id": "f6e94abf-89cd-4a58-80b6-9c496b300660",
      "name": "Store Raw Submission",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        -40,
        0
      ],
      "parameters": {
        "resource": "row",
        "operation": "insert",
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "orboto_idea_submissions"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "idea_title": "={{ $json.idea_title }}",
            "idea_description": "={{ $json.idea_description }}",
            "channel_or_link": "={{ $json.channel_or_link }}",
            "submitted_at": "={{ $json.submittedAt }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "idea_title",
              "displayName": "idea_title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "idea_description",
              "displayName": "idea_description",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "channel_or_link",
              "displayName": "channel_or_link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "submitted_at",
              "displayName": "submitted_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ]
        }
      }
    },
    {
      "id": "7139fbe1-0e25-4918-bbb6-167369a4eeee",
      "name": "Create Idea Ticket",
      "type": "n8n-nodes-orboto.orboto",
      "typeVersion": 1,
      "position": [
        180,
        0
      ],
      "parameters": {
        "resource": "ticket",
        "operation": "create",
        "authType": "apiKey",
        "project": "<__PLACEHOLDER_VALUE__orboto project key the ideas land in, e.g. ACME__>",
        "title": "={{ $('Submit an Idea').item.json.idea_title }}",
        "description": "={{ $('Submit an Idea').item.json.idea_description }}\n\nSource: {{ $('Submit an Idea').item.json.channel_or_link || 'submitted through the idea form' }}",
        "type": "task",
        "priority": "normal",
        "labelNames": [
          "idea"
        ]
      }
    },
    {
      "id": "1718215f-5192-4368-9b10-1e145fe2f2af",
      "name": "Confirm With Ticket Key",
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.5,
      "position": [
        400,
        0
      ],
      "parameters": {
        "operation": "completion",
        "respondWith": "text",
        "completionTitle": "Idea received",
        "completionMessage": "=Tracked as {{ $json.ticketKey }}. It sits in the backlog with the \"idea\" label - you get a message in the team channel the moment it reaches done."
      }
    },
    {
      "id": "9cfeef98-846f-4f18-a61b-dfecbd8baef8",
      "name": "Sticky Note Idea In",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        100,
        300
      ],
      "parameters": {
        "content": "## Idea in\n\nThe form writes every raw submission to the `orboto_idea_submissions` data table first, then opens the ticket. Fill the **orboto project key** placeholder on \"Create Idea Ticket\" and pick your orboto credential.",
        "color": 4
      }
    },
    {
      "id": "afe173a1-462c-4361-bdef-a1df881bda47",
      "name": "Ticket Changed in orboto",
      "type": "n8n-nodes-orboto.orbotoTrigger",
      "typeVersion": 1,
      "position": [
        -260,
        320
      ],
      "parameters": {
        "authType": "apiKey",
        "project": "<__PLACEHOLDER_VALUE__orboto project key the ideas land in, e.g. ACME__>",
        "events": [
          "ticket.updated"
        ]
      }
    },
    {
      "id": "d4c76bd7-cee0-4ed9-8973-8f86d244ab45",
      "name": "Idea Ticket Reached Done?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -40,
        320
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "has-idea-label",
              "leftValue": "={{ ($json.labels || []).map(label => label.name) }}",
              "operator": {
                "type": "array",
                "operation": "contains"
              },
              "rightValue": "idea"
            },
            {
              "id": "is-done",
              "leftValue": "={{ $json.statusCategory }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "done"
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true
      }
    },
    {
      "id": "203a053e-6d6d-4b66-87b5-a1b87b8dc88a",
      "name": "Build Done Message",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        180,
        240
      ],
      "parameters": {
        "mode": "manual",
        "includeOtherFields": true,
        "assignments": {
          "assignments": [
            {
              "id": "done-message",
              "name": "message",
              "value": "=Shipped: {{ $json.ticketKey }} - {{ $json.title }} (status: {{ $json.status ?? \"done\" }})",
              "type": "string"
            }
          ]
        }
      }
    },
    {
      "id": "6a4d7432-993a-4f7f-8cbc-5e39c441a044",
      "name": "Post to Discord Webhook",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        400,
        160
      ],
      "parameters": {
        "method": "POST",
        "url": "<__PLACEHOLDER_VALUE__Discord webhook URL - Channel settings, Integrations, Webhooks__>",
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "keypair",
        "bodyParameters": {
          "parameters": [
            {
              "name": "content",
              "value": "={{ $json.message }}"
            }
          ]
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "id": "30ad7188-daf5-49ad-a29b-ab130d247531",
      "name": "Post to Slack Webhook",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        400,
        340
      ],
      "parameters": {
        "method": "POST",
        "url": "<__PLACEHOLDER_VALUE__Slack incoming webhook URL - Slack app settings, Incoming Webhooks__>",
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "keypair",
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={{ $json.message }}"
            }
          ]
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "id": "810918cd-00a0-4b97-9fb6-1ebf7d4f2f2e",
      "name": "Sticky Note Done Out",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        100,
        560
      ],
      "parameters": {
        "content": "## Done out\n\nThe orboto Trigger registers its webhook when you **activate** the workflow. Deliveries are HMAC verified. Only tickets carrying the \"idea\" label that reached a done status are announced.",
        "color": 5
      }
    }
  ],
  "connections": {
    "Submit an Idea": {
      "main": [
        [
          {
            "node": "Store Raw Submission",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Raw Submission": {
      "main": [
        [
          {
            "node": "Create Idea Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Idea Ticket": {
      "main": [
        [
          {
            "node": "Confirm With Ticket Key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ticket Changed in orboto": {
      "main": [
        [
          {
            "node": "Idea Ticket Reached Done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Idea Ticket Reached Done?": {
      "main": [
        [
          {
            "node": "Build Done Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Done Message": {
      "main": [
        [
          {
            "node": "Post to Discord Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to Slack Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
