{
  "name": "List recent ServiceNow incidents in Slack using pop up modal",
  "nodes": [
    {
      "id": "a9a92b8a-05cf-4d9e-ae01-be3b17346893",
      "name": "Parse Webhook",
      "type": "n8n-nodes-base.set",
      "position": [
        -560,
        660
      ]
    },
    {
      "id": "f999011b-e54d-4514-94ec-4d544af4d145",
      "name": "Close Modal Popup",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -160,
        1120
      ]
    },
    {
      "id": "a16d64a0-fe07-4cae-b458-a91937e57a4e",
      "name": "Route Message",
      "type": "n8n-nodes-base.switch",
      "position": [
        -380,
        660
      ]
    },
    {
      "id": "54fa31d5-7259-4c19-8891-8b559af87959",
      "name": "ServiceNow Modal",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        260,
        560
      ]
    },
    {
      "id": "d16de218-b99b-4d13-9655-8fe1a329e01f",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -760,
        660
      ]
    },
    {
      "id": "57ee358a-d409-42e7-8200-4475c4c59263",
      "name": "Send 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -160,
        1660
      ]
    },
    {
      "id": "86b0fd85-b3d5-456c-8f59-0f29f283969f",
      "name": "ServiceNow",
      "type": "n8n-nodes-base.serviceNow",
      "position": [
        100,
        1120
      ]
    },
    {
      "id": "95fcd7f1-ac3a-4128-8b4a-84b636487d9e",
      "name": "Channel - Notify User no Incidents Matched",
      "type": "n8n-nodes-base.slack",
      "position": [
        960,
        1360
      ]
    },
    {
      "id": "7f638817-6f97-42a9-9027-dd0d5fb6f560",
      "name": "DM - Notify User no Incidents Matched",
      "type": "n8n-nodes-base.slack",
      "position": [
        960,
        1600
      ]
    },
    {
      "id": "f3a21223-9e74-4066-af9f-6b94f69cb01f",
      "name": "Were Incidents Found?",
      "type": "n8n-nodes-base.if",
      "position": [
        360,
        1120
      ]
    },
    {
      "id": "e27438cb-ba24-4a3b-8fe8-52b7d39cb1e0",
      "name": "No Matches - Was a Channel Selected?",
      "type": "n8n-nodes-base.if",
      "position": [
        580,
        1480
      ]
    },
    {
      "id": "de7d3155-1c6d-43a1-9cc0-4900d176fd3e",
      "name": "Sort by Most Recent",
      "type": "n8n-nodes-base.sort",
      "position": [
        580,
        580
      ]
    },
    {
      "id": "19f529c7-bfe6-4713-8ed3-d80ecc0078de",
      "name": "Retain First 5 Incidents",
      "type": "n8n-nodes-base.limit",
      "position": [
        740,
        580
      ]
    },
    {
      "id": "9b095ad5-dedc-43e6-9ab3-947b90e7145d",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        920,
        580
      ]
    },
    {
      "id": "9a236a69-3ea5-46f5-8f2d-f7421bff638a",
      "name": "Format Incident Details",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        680
      ]
    },
    {
      "id": "6e15b991-d9d5-4244-a3db-dbd37c248303",
      "name": "Format Slack Message",
      "type": "n8n-nodes-base.set",
      "position": [
        1320,
        500
      ]
    },
    {
      "id": "08182589-800d-4ce6-8654-fc53d2ee56c3",
      "name": "Concatenate Incident Details",
      "type": "n8n-nodes-base.summarize",
      "position": [
        1140,
        500
      ]
    },
    {
      "id": "86b698d2-2854-4393-8ee8-76f8e7b01586",
      "name": "DM - Send Matching Incidents",
      "type": "n8n-nodes-base.slack",
      "position": [
        1880,
        720
      ]
    },
    {
      "id": "cbd8fbc3-d589-4625-99b5-a98e6a41d4bb",
      "name": "Channel - Send Matching Incidents",
      "type": "n8n-nodes-base.slack",
      "position": [
        1880,
        520
      ]
    },
    {
      "id": "c3ed618f-b65e-4df2-80c0-90b2e2be3783",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -709.4873251551015
      ],
      "parameters": {
        "width": 709.3965558024038,
        "height": 887.8719128264411,
        "content": "![Slack](https://uploads.n8n.io/templates/servicenowmodalinterface.png)\n## Slack Modal Interface\n\nWhen triggered, Slack will display this interface to allow Slack users to search ServiceNow for ticket"
      }
    },
    {
      "id": "69f47cb7-84c6-4037-b3ba-8364ec572fde",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -798.751282964615,
        190.55356752462308
      ],
      "parameters": {
        "width": 579.6865154062818,
        "height": 647.0013506366993,
        "content": "![Slack](https://uploads.n8n.io/templates/slack.png)\n## Receive and Parse Slack Event via Webhook\n\nThis section begins with the `Webhook` node, which captures events from Slack, such as modal submissi"
      }
    },
    {
      "id": "622f63e4-fd03-4a76-bb2d-04a2daea9a46",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        188.05676141451897
      ],
      "parameters": {
        "width": 710.3172669178614,
        "height": 563.0861092667175,
        "content": "![Slack](https://uploads.n8n.io/templates/slack.png)\n## Respond to Modal request\n\nThis section starts with the `Respond to Slack Webhook`, which sends an acknowledgment to Slack after a modal interact"
      }
    },
    {
      "id": "16d7f224-7792-4e9f-ae5c-1c0b6a39e703",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        760
      ],
      "parameters": {
        "width": 709.0896745965773,
        "height": 550.5825149622945,
        "content": "![Servicenow](https://uploads.n8n.io/templates/servicenow.png)\n## Close Modal and Search Service Now\n\nThis section starts with the `Close Modal Popup` node, which sends a response to Slack to close th"
      }
    },
    {
      "id": "3f52816d-db59-4574-b82e-8a9ca854e049",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        526.5720643091352,
        908.7025500703817
      ],
      "parameters": {
        "width": 714.3631681325317,
        "height": 911.8420872184945,
        "content": "![Slack](https://uploads.n8n.io/templates/slack.png)\n## No Incidents found, respond to Slack\n\nThis section begins with the `No Matches - Was a Channel Selected?` node, which evaluates whether the user"
      }
    },
    {
      "id": "22943cc9-c79c-4465-ac9e-040d5f49a879",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        1328.507039277291
      ],
      "parameters": {
        "width": 709.4188646504804,
        "height": 492.8100521251637,
        "content": "![Slack](https://uploads.n8n.io/templates/slack.png)\n## Respond to Slack Button Press with 200 Response\n\nThis section uses the `Send 200` node to send a 200 HTTP response back to Slack whenever a butt"
      }
    },
    {
      "id": "95d4d5e1-5f6b-4107-a55d-51e70c25c055",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528.3624557345836,
        26.66938195987973
      ],
      "parameters": {
        "width": 956.6393374313541,
        "height": 870.8771447693905,
        "content": "![n8n](https://uploads.n8n.io/templates/n8n.png)\n## Sort and format Results for block kit\n\nThis section begins by organizing the incident data retrieved from ServiceNow. The `Sort by Most Recent` node"
      }
    },
    {
      "id": "2d55c76a-f7ba-46ec-acc1-13f54b22b2ee",
      "name": "Was a Channel Selected?",
      "type": "n8n-nodes-base.if",
      "position": [
        1580,
        580
      ]
    },
    {
      "id": "70792926-097f-4f2b-b3b4-afc7bad60ea6",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1500,
        27.218710650838375
      ],
      "parameters": {
        "width": 657.1120966423081,
        "height": 870.9953951550463,
        "content": "![Slack](https://uploads.n8n.io/templates/slack.png)\n## Check if Slack channel selected and send Incident results in block kit format\n\nThis section begins with the `Was a Channel Selected?` node, whic"
      }
    },
    {
      "id": "0ae7f5bf-7a78-42f6-95aa-c0f685e63c40",
      "name": "Respond to Slack Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -100,
        560
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Parse Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ServiceNow": {
      "main": [
        [
          {
            "node": "Were Incidents Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Webhook": {
      "main": [
        [
          {
            "node": "Route Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Message": {
      "main": [
        [
          {
            "node": "Respond to Slack Webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Close Modal Popup",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send 200",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Concatenate Incident Details",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Incident Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Close Modal Popup": {
      "main": [
        [
          {
            "node": "ServiceNow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by Most Recent": {
      "main": [
        [
          {
            "node": "Retain First 5 Incidents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Slack Message": {
      "main": [
        [
          {
            "node": "Was a Channel Selected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Were Incidents Found?": {
      "main": [
        [
          {
            "node": "Sort by Most Recent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Matches - Was a Channel Selected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Incident Details": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Was a Channel Selected?": {
      "main": [
        [
          {
            "node": "Channel - Send Matching Incidents",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "DM - Send Matching Incidents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Slack Webhook": {
      "main": [
        [
          {
            "node": "ServiceNow Modal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retain First 5 Incidents": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Concatenate Incident Details": {
      "main": [
        [
          {
            "node": "Format Slack Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Matches - Was a Channel Selected?": {
      "main": [
        [
          {
            "node": "Channel - Notify User no Incidents Matched",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "DM - Notify User no Incidents Matched",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}