{
  "id": "vB3A3Tmh1GZJ4DGF",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": [],
  "nodes": [
    {
      "id": "a4227858-806b-4eab-8f25-34b5d2b584f0",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        460
      ],
      "parameters": {
        "color": 7,
        "width": 580,
        "height": 440,
        "content": "\n# Daily YouTrack In-Progress Tasks Summary to Discord by Assignee \n\n\n## \ud83d\udd27 Setup Instructions\n\n### YouTrack Configuration:\n\n - Get a permanent token: Auth guide\n - Set the base API URL\n - Identify custom field IDs (e.g. for Status, Assignee, Priority)\n\n### Discord Configuration:\n - Create a webhook URL for your target channel\n - Webhook setup guide\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a953219c-bc9a-45f7-8413-e07b2a191d26",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        400,
        1140
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "=days",
              "triggerAtHour": 11
            }
          ]
        }
      },
      "notesInFlow": "Run every day at 11:00 AM",
      "typeVersion": 1.2
    },
    {
      "id": "219199a1-63f1-497d-a2b4-7726e6086483",
      "name": "Weekend checker",
      "type": "n8n-nodes-base.code",
      "position": [
        600,
        1140
      ],
      "parameters": {
        "jsCode": "// Get the day of the week from input\nconst dayOfWeek = $json[\"Day of week\"];\nconst isWeekday = (dayOfWeek !== \"Saturday\" && dayOfWeek !== \"Sunday\");\nreturn [{ json: { continueProcessing: isWeekday } }];"
      },
      "notesInFlow": "Skip weekends",
      "typeVersion": 2
    },
    {
      "id": "d6826f58-5aa2-450e-8b16-5374f71405dd",
      "name": "If it is weekend, the script is not run",
      "type": "n8n-nodes-base.if",
      "position": [
        800,
        1140
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "COND_ID_1",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.continueProcessing }}",
              "rightValue": "={{ 0 }}"
            }
          ]
        }
      },
      "notesInFlow": "Stop if it's weekend",
      "typeVersion": 2.2
    },
    {
      "id": "39c23755-d01b-44d0-bb7a-31e8cbe759ca",
      "name": "HTTP Request YT",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        960
      ],
      "parameters": {
        "url": "{{API_URL}}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "fields",
              "value": "{{QUERY_FIELDS}}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{TOKEN}}"
            }
          ]
        }
      },
      "notesInFlow": "Get YouTrack issues with 'In Progress' status",
      "typeVersion": 4.2
    },
    {
      "id": "175a0d7d-09b7-4c2f-9d59-94e901a3b36f",
      "name": "Filter fields",
      "type": "n8n-nodes-base.filter",
      "position": [
        1240,
        960
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "COND_ID_2",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.customFields.filter(item => item.projectCustomField.field.id == \"{{FIELD_ID}}\" )[0].value.localizedName }}",
              "rightValue": "In Progress"
            }
          ]
        }
      },
      "notesInFlow": "Filter only relevant tasks",
      "typeVersion": 2.2
    },
    {
      "id": "8bfe2447-6a78-4ee3-97f3-6c9aefbc3d7a",
      "name": "Discord message",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        960
      ],
      "parameters": {
        "jsCode": "// Code omitted for brevity..."
      },
      "notesInFlow": "Format Discord message with tasks",
      "typeVersion": 2
    },
    {
      "id": "e6709cc9-b288-4b6e-b634-e992d90ff9d9",
      "name": "Discord notification",
      "type": "n8n-nodes-base.discord",
      "position": [
        1640,
        960
      ],
      "parameters": {
        "content": "={{ $json.content }}",
        "options": {},
        "authentication": "webhook"
      },
      "notesInFlow": "Send the message to Discord",
      "typeVersion": 2
    },
    {
      "id": "fade68a5-236c-46d4-bab7-d8d48c38d238",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        1360
      ],
      "parameters": {
        "color": 6,
        "width": 460,
        "height": 280,
        "content": "### \ud83e\udde9 Environment Variables & Placeholders\n\n| Placeholder           | Description                         |\n|-----------------------|-------------------------------------|\n| `{{API_URL}}`         | Your YouTrack API base URL          |\n| `{{TOKEN}}`           | YouTrack permanent token            |\n| `{{FIELD_ID}}`        | ID of the \"Status\" custom field     |\n| `{{QUERY_FIELDS}}`    | Fields to fetch (e.g., summary, id) |\n| `{{PROJECT_LINK}}`    | Link to your YouTrack project       |\n| `{{USER_X}}`          | YouTrack usernames                  |\n| `{{DISCORD_ID_X}}`    | Discord mentions or usernames       |\n| `{{NAME_X}}`          | Display names                       |\n| `{{WEBHOOK_ID}}`      | Discord webhook ID                  |\n| `{{DISCORD_CHANNEL}}` | Discord channel name                |\n| `{{CREDENTIAL_ID}}`   | Your credential ID in n8n           |\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0a519fb3-e088-4bb6-98ce-e61fdcf006ee",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1340,
        760
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 140,
        "content": "\n#### \ud83d\udcdd This workflow uses **Discord** as an example. You can easily replace the messaging integration with Slack, Mattermost, MS Teams, or any other platform that supports incoming webhooks."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4cb4d3c9-459c-4f0d-925a-4530a94e8fa3",
  "connections": {
    "Filter fields": {
      "main": [
        [
          {
            "node": "Discord message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Discord message": {
      "main": [
        [
          {
            "node": "Discord notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request YT": {
      "main": [
        [
          {
            "node": "Filter fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekend checker": {
      "main": [
        [
          {
            "node": "If it is weekend, the script is not run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Weekend checker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If it is weekend, the script is not run": {
      "main": [
        [
          {
            "node": "HTTP Request YT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}