{
  "type": "workflow_collections",
  "macros": [],
  "exported_tags": [
    "Microsoft",
    "microsoft-graph-mail-v2",
    "use-case"
  ],
  "data": [
    {
      "@type": "WorkflowCollection",
      "name": "SOC Use Cases - Microsoft Graph Mail v2",
      "description": "Use-case playbooks for the Microsoft Graph Mail connector on a Microsoft 365 tenant: triage of a user-reported phishing message (quarantine and tag, or clear and reply), and a reusable notify-owner helper that sends through Graph.",
      "visible": true,
      "image": null,
      "uuid": "58112e80-6eb1-5df6-8009-a94087f5b9fb",
      "recordTags": [
        "microsoft-graph-mail-v2",
        "Microsoft",
        "use-case"
      ],
      "workflows": [
        {
          "@type": "Workflow",
          "name": "Graph Mail - Phishing report triage",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "Pulls a user-reported message with its headers, reads the Authentication-Results header and the subject and preview for phishing keywords, and derives a verdict. Suspicious: moves the message to Junk, tags it, logs an alert and replies to the reporter. Clean: tags it as reviewed, logs an alert and tells the reporter.",
          "isActive": false,
          "debug": false,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "mailbox",
            "message_id",
            "reporter"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/89cd4a2b-e1b2-5ab4-a576-3eb1e842c08c",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "mailbox"
                  },
                  {
                    "name": "message_id"
                  },
                  {
                    "name": "reporter"
                  }
                ],
                "title": "Graph Mail - Phishing report triage",
                "resources": [
                  "alerts"
                ],
                "route": "a75fe436-178b-5497-824d-df248ebef35c",
                "step_variables": {
                  "input": {
                    "params": {
                      "mailbox": "{{vars.request.data[\"mailbox\"]}}",
                      "message_id": "{{vars.request.data[\"message_id\"]}}",
                      "reporter": "{{vars.request.data[\"reporter\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "alerts": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "89cd4a2b-e1b2-5ab4-a576-3eb1e842c08c"
            },
            {
              "@type": "WorkflowStep",
              "name": "Fetch Reported Message",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "get_message",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "message_id": "{{ vars.input.params.message_id }}"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Get Message",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "168f3333-2170-5467-8e16-4afcd1db7491"
            },
            {
              "@type": "WorkflowStep",
              "name": "Derive Indicators",
              "description": null,
              "arguments": {
                "auth_results": "{{ (vars.steps.Fetch_Reported_Message.data.internetMessageHeaders | selectattr('name', 'equalto', 'Authentication-Results') | map(attribute='value') | first | default('')) | lower }}",
                "dmarc_failed": "{{ 'dmarc=fail' in ((vars.steps.Fetch_Reported_Message.data.internetMessageHeaders | selectattr('name', 'equalto', 'Authentication-Results') | map(attribute='value') | first | default('')) | lower) }}",
                "sender_address": "{{ vars.steps.Fetch_Reported_Message.data.from.emailAddress.address | default('') }}",
                "subject_text": "{{ ((vars.steps.Fetch_Reported_Message.data.subject | default('')) ~ ' ' ~ (vars.steps.Fetch_Reported_Message.data.bodyPreview | default(''))) | lower }}",
                "keyword_hits": "{{ ['wire transfer', 'password expires', 'invoice', 'verify your account', 'shared document', 'urgent'] | select('in', ((vars.steps.Fetch_Reported_Message.data.subject | default('')) ~ ' ' ~ (vars.steps.Fetch_Reported_Message.data.bodyPreview | default(''))) | lower) | list }}"
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "51915d52-0085-5845-8078-11371c8a661f"
            },
            {
              "@type": "WorkflowStep",
              "name": "Verdict",
              "description": null,
              "arguments": {
                "conditions": [
                  {
                    "option": "suspicious (DMARC failed or phishing keywords)",
                    "condition": "{{ (vars.dmarc_failed | string | lower == 'true') or ((vars.keyword_hits | length) > 0) }}",
                    "step_iri": "/api/3/workflow_steps/c73552ba-371c-5c06-9801-9d7fbd843886",
                    "step_name": "Quarantine Message"
                  },
                  {
                    "option": "Else",
                    "default": true,
                    "step_iri": "/api/3/workflow_steps/3619c367-4aec-56ab-83e7-70cb00306a0e",
                    "step_name": "Clear Message"
                  }
                ]
              },
              "status": null,
              "top": "510",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/12254cf5-5db7-4b1a-8cb1-3af081924b28",
              "group": null,
              "uuid": "d8227092-7991-55cf-871e-88c0c46633c7"
            },
            {
              "@type": "WorkflowStep",
              "name": "Quarantine Message",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "move_email",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "destination_folder": "Folder Path",
                  "folder_id": "Junk Email",
                  "message_id": "{{ vars.input.params.message_id }}"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Move Email",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "640",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "c73552ba-371c-5c06-9801-9d7fbd843886"
            },
            {
              "@type": "WorkflowStep",
              "name": "Tag Quarantined",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "add_email_category",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "message_id": "{{ vars.steps.Quarantine_Message.data.id }}",
                  "category": "FS-Phish-Quarantined"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Add Email Category",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "770",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "4b6e52af-d754-5564-a5d4-4dc3d200b74b"
            },
            {
              "@type": "WorkflowStep",
              "name": "Log Quarantine",
              "description": null,
              "arguments": {
                "resource": {
                  "name": "Phishing report quarantined: {{ vars.steps.Fetch_Reported_Message.data.subject }}",
                  "description": "Reported by {{ vars.input.params.reporter }}. DMARC failed: {{ vars.dmarc_failed }}. Keyword hits: {{ vars.keyword_hits | join(', ') }}. Moved to Junk and tagged FS-Phish-Quarantined."
                },
                "collection": "/api/3/alerts"
              },
              "status": null,
              "top": "900",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/2597053c-e718-44b4-8394-4d40fe26d357",
              "group": null,
              "uuid": "ac5bab8d-4664-50e8-b96d-0fd3b00ac40b"
            },
            {
              "@type": "WorkflowStep",
              "name": "Reply To Reporter Quarantined",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "send_email",
                "config": "",
                "params": {
                  "from": "{{ vars.input.params.mailbox }}",
                  "body_type": "Rich Text",
                  "to_recipients": "{{ vars.input.params.reporter }}",
                  "subject": "Re: reported message quarantined",
                  "body": "<p>Thanks for reporting. The message was moved to Junk and tagged for review. Do not click links or open attachments from it.</p>"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Send Email",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1030",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "4b56b81a-d65c-5f97-8111-35400a847984"
            },
            {
              "@type": "WorkflowStep",
              "name": "Clear Message",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "add_email_category",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "message_id": "{{ vars.input.params.message_id }}",
                  "category": "FS-Reviewed-Clean"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Add Email Category",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "640",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "3619c367-4aec-56ab-83e7-70cb00306a0e"
            },
            {
              "@type": "WorkflowStep",
              "name": "Log Clear",
              "description": null,
              "arguments": {
                "resource": {
                  "name": "Phishing report reviewed, no indicators: {{ vars.steps.Fetch_Reported_Message.data.subject }}",
                  "description": "Reported by {{ vars.input.params.reporter }}. DMARC failed: {{ vars.dmarc_failed }}. No phishing keywords. Tagged FS-Reviewed-Clean; message left in place."
                },
                "collection": "/api/3/alerts"
              },
              "status": null,
              "top": "770",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/2597053c-e718-44b4-8394-4d40fe26d357",
              "group": null,
              "uuid": "ffa1b88b-3c3c-503b-b0eb-3b856a95512b"
            },
            {
              "@type": "WorkflowStep",
              "name": "Reply To Reporter Clean",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "send_email",
                "config": "",
                "params": {
                  "from": "{{ vars.input.params.mailbox }}",
                  "body_type": "Rich Text",
                  "to_recipients": "{{ vars.input.params.reporter }}",
                  "subject": "Re: reported message reviewed",
                  "body": "<p>Thanks for reporting. We reviewed the message and found no phishing indicators. It stays in your mailbox.</p>"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Send Email",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "900",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "d8ab8319-ff62-5c8f-a569-c945b1f17261"
            },
            {
              "@type": "WorkflowStep",
              "name": "End",
              "description": null,
              "arguments": {
                "connector": "cyops_utilities",
                "operation": "no_op",
                "config": "",
                "params": {},
                "version": "3.7.3",
                "name": "Utilities",
                "operationTitle": "Utils: No Operation",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1160",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "0c8c5af3-9aca-56bb-bbe5-fbc8880c4ab9"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> Fetch Reported Message",
              "targetStep": "/api/3/workflow_steps/168f3333-2170-5467-8e16-4afcd1db7491",
              "sourceStep": "/api/3/workflow_steps/89cd4a2b-e1b2-5ab4-a576-3eb1e842c08c",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "ffe03208-3ae9-57c9-8c0f-d3d331f4ffb8"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Fetch Reported Message -> Derive Indicators",
              "targetStep": "/api/3/workflow_steps/51915d52-0085-5845-8078-11371c8a661f",
              "sourceStep": "/api/3/workflow_steps/168f3333-2170-5467-8e16-4afcd1db7491",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "5c767c5e-fa1d-53c3-b701-d8e16bca4bbc"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Derive Indicators -> Verdict",
              "targetStep": "/api/3/workflow_steps/d8227092-7991-55cf-871e-88c0c46633c7",
              "sourceStep": "/api/3/workflow_steps/51915d52-0085-5845-8078-11371c8a661f",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "1281d565-356e-5251-97c0-1e187858f601"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Verdict -> Quarantine Message",
              "targetStep": "/api/3/workflow_steps/c73552ba-371c-5c06-9801-9d7fbd843886",
              "sourceStep": "/api/3/workflow_steps/d8227092-7991-55cf-871e-88c0c46633c7",
              "label": "suspicious (DMARC failed or phishing keywords)",
              "isExecuted": false,
              "group": null,
              "uuid": "7d9f0ce3-d175-53b2-9f34-bbdef58a4065"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Verdict -> Clear Message",
              "targetStep": "/api/3/workflow_steps/3619c367-4aec-56ab-83e7-70cb00306a0e",
              "sourceStep": "/api/3/workflow_steps/d8227092-7991-55cf-871e-88c0c46633c7",
              "label": "Else",
              "isExecuted": false,
              "group": null,
              "uuid": "579d1609-58ab-5fce-89da-51cea19ce851"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Quarantine Message -> Tag Quarantined",
              "targetStep": "/api/3/workflow_steps/4b6e52af-d754-5564-a5d4-4dc3d200b74b",
              "sourceStep": "/api/3/workflow_steps/c73552ba-371c-5c06-9801-9d7fbd843886",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "fde4871d-6db3-5961-9c5f-db984b72932d"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Tag Quarantined -> Log Quarantine",
              "targetStep": "/api/3/workflow_steps/ac5bab8d-4664-50e8-b96d-0fd3b00ac40b",
              "sourceStep": "/api/3/workflow_steps/4b6e52af-d754-5564-a5d4-4dc3d200b74b",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "c3bc1b0b-e352-5328-904c-b8bb82f19cb4"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Log Quarantine -> Reply To Reporter Quarantined",
              "targetStep": "/api/3/workflow_steps/4b56b81a-d65c-5f97-8111-35400a847984",
              "sourceStep": "/api/3/workflow_steps/ac5bab8d-4664-50e8-b96d-0fd3b00ac40b",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "4aa0616c-5626-5e96-87dc-e59073997d18"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Reply To Reporter Quarantined -> End",
              "targetStep": "/api/3/workflow_steps/0c8c5af3-9aca-56bb-bbe5-fbc8880c4ab9",
              "sourceStep": "/api/3/workflow_steps/4b56b81a-d65c-5f97-8111-35400a847984",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "4bb3fa93-f91d-5f58-8974-97b4557cc4a1"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Clear Message -> Log Clear",
              "targetStep": "/api/3/workflow_steps/ffa1b88b-3c3c-503b-b0eb-3b856a95512b",
              "sourceStep": "/api/3/workflow_steps/3619c367-4aec-56ab-83e7-70cb00306a0e",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "f32e3253-d62a-57d2-b9f3-e14a2f869ae4"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Log Clear -> Reply To Reporter Clean",
              "targetStep": "/api/3/workflow_steps/d8ab8319-ff62-5c8f-a569-c945b1f17261",
              "sourceStep": "/api/3/workflow_steps/ffa1b88b-3c3c-503b-b0eb-3b856a95512b",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "cde4cbe8-0963-508d-a2f3-7f28b2dbd606"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Reply To Reporter Clean -> End",
              "targetStep": "/api/3/workflow_steps/0c8c5af3-9aca-56bb-bbe5-fbc8880c4ab9",
              "sourceStep": "/api/3/workflow_steps/d8ab8319-ff62-5c8f-a569-c945b1f17261",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "5da2f2cb-00a8-5b58-975d-c5c0b3a6910b"
            }
          ],
          "groups": [],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "ba5d0f9e-2b8f-5552-bfb9-ecb0ea7b2d76",
          "isPrivate": false
        },
        {
          "@type": "Workflow",
          "name": "Graph Mail - Notify owner (helper)",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "Sends one plain notification through Microsoft Graph from a mailbox to an owner. Callable on its own (manual inputs) and suitable for other playbooks, for example the SharePoint oversharing response. Does not reply to anything; it sends a new message.",
          "isActive": false,
          "debug": false,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "from_mailbox",
            "to_address",
            "subject",
            "body"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/21b995ba-a6fa-5c2c-b65f-ec2ba1da1f70",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "from_mailbox"
                  },
                  {
                    "name": "to_address"
                  },
                  {
                    "name": "subject"
                  },
                  {
                    "name": "body"
                  }
                ],
                "title": "Graph Mail - Notify owner",
                "resources": [
                  "alerts"
                ],
                "route": "0cdc64e4-3e3d-58a4-8658-30ffc5b985e9",
                "step_variables": {
                  "input": {
                    "params": {
                      "from_mailbox": "{{vars.request.data[\"from_mailbox\"]}}",
                      "to_address": "{{vars.request.data[\"to_address\"]}}",
                      "subject": "{{vars.request.data[\"subject\"]}}",
                      "body": "{{vars.request.data[\"body\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "alerts": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "21b995ba-a6fa-5c2c-b65f-ec2ba1da1f70"
            },
            {
              "@type": "WorkflowStep",
              "name": "Send Notification",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "send_email",
                "config": "",
                "params": {
                  "from": "{{ vars.input.params.from_mailbox }}",
                  "body_type": "Rich Text",
                  "to_recipients": "{{ vars.input.params.to_address }}",
                  "subject": "{{ vars.input.params.subject }}",
                  "body": "{{ vars.input.params.body }}"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Send Email",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "28f90e8a-251c-5345-af6b-3ef82dcfebed"
            },
            {
              "@type": "WorkflowStep",
              "name": "End",
              "description": null,
              "arguments": {
                "connector": "cyops_utilities",
                "operation": "no_op",
                "config": "",
                "params": {},
                "version": "3.7.3",
                "name": "Utilities",
                "operationTitle": "Utils: No Operation",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "3ab4101a-2e97-5539-8615-d0e6b5e9956e"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> Send Notification",
              "targetStep": "/api/3/workflow_steps/28f90e8a-251c-5345-af6b-3ef82dcfebed",
              "sourceStep": "/api/3/workflow_steps/21b995ba-a6fa-5c2c-b65f-ec2ba1da1f70",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "b1b6bbda-31e5-5755-9f65-ab538a18eff3"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Send Notification -> End",
              "targetStep": "/api/3/workflow_steps/3ab4101a-2e97-5539-8615-d0e6b5e9956e",
              "sourceStep": "/api/3/workflow_steps/28f90e8a-251c-5345-af6b-3ef82dcfebed",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "dc4fe900-f29f-5864-bb8c-0b5f8b7527a0"
            }
          ],
          "groups": [],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "66b35ae2-2781-55cc-817b-4eeafd955c8e",
          "isPrivate": false
        },
        {
          "@type": "Workflow",
          "name": "Graph Mail - Mailbox rule forensics",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "After an account compromise, lists the Inbox rules of a mailbox and removes every rule that forwards mail to another address (the usual exfiltration pattern). Logs an alert with the removed rule names and notifies the owner. A mailbox with no forwarding rules logs a clean result.",
          "isActive": false,
          "debug": false,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "mailbox",
            "notify"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/1c1002b1-5156-56ee-adda-edeca4ed6505",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "mailbox"
                  },
                  {
                    "name": "notify"
                  }
                ],
                "title": "Graph Mail - Mailbox rule forensics",
                "resources": [
                  "alerts"
                ],
                "route": "b359ef9d-555b-55f7-a5f2-1c381658b5b0",
                "step_variables": {
                  "input": {
                    "params": {
                      "mailbox": "{{vars.request.data[\"mailbox\"]}}",
                      "notify": "{{vars.request.data[\"notify\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "alerts": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "1c1002b1-5156-56ee-adda-edeca4ed6505"
            },
            {
              "@type": "WorkflowStep",
              "name": "List Inbox Rules",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "list_inbox_rules",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "List Inbox Rules",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "7e68d058-dc7a-5586-b238-c94572e1dd69"
            },
            {
              "@type": "WorkflowStep",
              "name": "Count Forwarding Rules",
              "description": null,
              "arguments": {
                "forward_count": "{{ vars.steps.List_Inbox_Rules.data | selectattr('forwardsOrRedirects') | list | length }}"
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "1392b217-8450-5136-80a7-c9d78b408afd"
            },
            {
              "@type": "WorkflowStep",
              "name": "Any Forwarding Rule",
              "description": null,
              "arguments": {
                "conditions": [
                  {
                    "option": "forwarding rules present",
                    "condition": "{{ (vars.forward_count | int) > 0 }}",
                    "step_iri": "/api/3/workflow_steps/8f1d2811-a9aa-5ba6-9d29-df587feea71e",
                    "step_name": "Remove Forwarding Rules"
                  },
                  {
                    "option": "Else",
                    "default": true,
                    "step_iri": "/api/3/workflow_steps/df8bbf63-06b5-5e4b-8e5a-f7f694c95e30",
                    "step_name": "Log Clean Mailbox"
                  }
                ]
              },
              "status": null,
              "top": "510",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/12254cf5-5db7-4b1a-8cb1-3af081924b28",
              "group": null,
              "uuid": "a96580af-2652-533f-840d-1d6620eb7ed8"
            },
            {
              "@type": "WorkflowStep",
              "name": "Remove Forwarding Rules",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "delete_inbox_rule",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "rule_id": "{{ vars.item.id }}"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Delete Inbox Rule",
                "step_variables": [],
                "pickFromTenant": false,
                "for_each": {
                  "item": "{{ vars.steps.List_Inbox_Rules.data | selectattr('forwardsOrRedirects') | list }}",
                  "parallel": false,
                  "condition": ""
                }
              },
              "status": null,
              "top": "640",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "8f1d2811-a9aa-5ba6-9d29-df587feea71e"
            },
            {
              "@type": "WorkflowStep",
              "name": "Log Rule Removal",
              "description": null,
              "arguments": {
                "resource": {
                  "name": "Mailbox forwarding rules removed: {{ vars.input.params.mailbox }}",
                  "description": "Removed {{ vars.forward_count }} inbox rule(s) that forwarded mail: {{ vars.steps.List_Inbox_Rules.data | selectattr('forwardsOrRedirects') | map(attribute='displayName') | join(', ') }}. Account should be reset and sessions revoked."
                },
                "collection": "/api/3/alerts"
              },
              "status": null,
              "top": "770",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/2597053c-e718-44b4-8394-4d40fe26d357",
              "group": null,
              "uuid": "fcd83cad-f763-5166-a2ec-bbdfad446a60"
            },
            {
              "@type": "WorkflowStep",
              "name": "Notify Mailbox Owner",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "send_email",
                "config": "",
                "params": {
                  "from": "{{ vars.input.params.notify }}",
                  "body_type": "Rich Text",
                  "to_recipients": "{{ vars.input.params.notify }}",
                  "subject": "Forwarding rules removed from {{ vars.input.params.mailbox }}",
                  "body": "<p>Inbox rules that forwarded mail were removed from {{ vars.input.params.mailbox }}. Review the account; sign-in sessions should be revoked and the password reset.</p>"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Send Email",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "900",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "ca3e2d05-08cb-5290-af0b-ba57cc381e57"
            },
            {
              "@type": "WorkflowStep",
              "name": "Log Clean Mailbox",
              "description": null,
              "arguments": {
                "resource": {
                  "name": "Mailbox rule check clean: {{ vars.input.params.mailbox }}",
                  "description": "No inbox rule forwarded mail on {{ vars.input.params.mailbox }}."
                },
                "collection": "/api/3/alerts"
              },
              "status": null,
              "top": "640",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/2597053c-e718-44b4-8394-4d40fe26d357",
              "group": null,
              "uuid": "df8bbf63-06b5-5e4b-8e5a-f7f694c95e30"
            },
            {
              "@type": "WorkflowStep",
              "name": "End",
              "description": null,
              "arguments": {
                "connector": "cyops_utilities",
                "operation": "no_op",
                "config": "",
                "params": {},
                "version": "3.7.3",
                "name": "Utilities",
                "operationTitle": "Utils: No Operation",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1030",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "a4b7c69a-5a55-5097-a4c4-e930f485a3b9"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> List Inbox Rules",
              "targetStep": "/api/3/workflow_steps/7e68d058-dc7a-5586-b238-c94572e1dd69",
              "sourceStep": "/api/3/workflow_steps/1c1002b1-5156-56ee-adda-edeca4ed6505",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "f4bbbcb6-dea8-5563-8ca0-f4151b507379"
            },
            {
              "@type": "WorkflowRoute",
              "name": "List Inbox Rules -> Count Forwarding Rules",
              "targetStep": "/api/3/workflow_steps/1392b217-8450-5136-80a7-c9d78b408afd",
              "sourceStep": "/api/3/workflow_steps/7e68d058-dc7a-5586-b238-c94572e1dd69",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "42288549-faaf-5278-a991-275932a4998d"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Count Forwarding Rules -> Any Forwarding Rule",
              "targetStep": "/api/3/workflow_steps/a96580af-2652-533f-840d-1d6620eb7ed8",
              "sourceStep": "/api/3/workflow_steps/1392b217-8450-5136-80a7-c9d78b408afd",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "0c4d77be-0b44-5cba-be74-3d93cf7ea2de"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Any Forwarding Rule -> Remove Forwarding Rules",
              "targetStep": "/api/3/workflow_steps/8f1d2811-a9aa-5ba6-9d29-df587feea71e",
              "sourceStep": "/api/3/workflow_steps/a96580af-2652-533f-840d-1d6620eb7ed8",
              "label": "forwarding rules present",
              "isExecuted": false,
              "group": null,
              "uuid": "19ece099-0d54-519e-9309-53dcebcafa1a"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Any Forwarding Rule -> Log Clean Mailbox",
              "targetStep": "/api/3/workflow_steps/df8bbf63-06b5-5e4b-8e5a-f7f694c95e30",
              "sourceStep": "/api/3/workflow_steps/a96580af-2652-533f-840d-1d6620eb7ed8",
              "label": "Else",
              "isExecuted": false,
              "group": null,
              "uuid": "4e5df127-f0bc-5050-b177-c43798e6d704"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Remove Forwarding Rules -> Log Rule Removal",
              "targetStep": "/api/3/workflow_steps/fcd83cad-f763-5166-a2ec-bbdfad446a60",
              "sourceStep": "/api/3/workflow_steps/8f1d2811-a9aa-5ba6-9d29-df587feea71e",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "fb0f1001-b1cd-53a3-98b1-e3b8d0090393"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Log Rule Removal -> Notify Mailbox Owner",
              "targetStep": "/api/3/workflow_steps/ca3e2d05-08cb-5290-af0b-ba57cc381e57",
              "sourceStep": "/api/3/workflow_steps/fcd83cad-f763-5166-a2ec-bbdfad446a60",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "5a909133-5b8e-5de5-bb77-58f32887d75b"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Notify Mailbox Owner -> End",
              "targetStep": "/api/3/workflow_steps/a4b7c69a-5a55-5097-a4c4-e930f485a3b9",
              "sourceStep": "/api/3/workflow_steps/ca3e2d05-08cb-5290-af0b-ba57cc381e57",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "b8933b2b-6dc9-542d-a356-82a67f5b1d26"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Log Clean Mailbox -> End",
              "targetStep": "/api/3/workflow_steps/a4b7c69a-5a55-5097-a4c4-e930f485a3b9",
              "sourceStep": "/api/3/workflow_steps/df8bbf63-06b5-5e4b-8e5a-f7f694c95e30",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "0cb4990f-047c-59fb-ab79-c6d1bd912b16"
            }
          ],
          "groups": [],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "9e5a33e3-ef1f-52d3-bfb1-6ab3878190d4",
          "isPrivate": false
        },
        {
          "@type": "Workflow",
          "name": "Graph Mail - Suspicious sender sweep",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "Sweeps the Inbox of several mailboxes for every message from one sender and moves the matches to Junk. One child playbook run per mailbox; the parent sums the moved counts and notifies the caller.",
          "isActive": false,
          "debug": false,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "sender",
            "mailboxes",
            "notify"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/ca8701be-a99c-5111-b20c-a5baaee49c02",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "sender"
                  },
                  {
                    "name": "mailboxes"
                  },
                  {
                    "name": "notify"
                  }
                ],
                "title": "Graph Mail - Suspicious sender sweep",
                "resources": [
                  "alerts"
                ],
                "route": "e4b6e037-aa25-574c-b8c6-014442c8006e",
                "step_variables": {
                  "input": {
                    "params": {
                      "sender": "{{vars.request.data[\"sender\"]}}",
                      "mailboxes": "{{vars.request.data[\"mailboxes\"]}}",
                      "notify": "{{vars.request.data[\"notify\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "alerts": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "ca8701be-a99c-5111-b20c-a5baaee49c02"
            },
            {
              "@type": "WorkflowStep",
              "name": "Split Mailboxes",
              "description": null,
              "arguments": {
                "mailbox_list": "{{ vars.input.params.mailboxes.split(',') | map('trim') | reject('equalto', '') | list }}"
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "51b62536-d5f7-5752-831b-c02657e11992"
            },
            {
              "@type": "WorkflowStep",
              "name": "Sweep Each Mailbox",
              "description": null,
              "arguments": {
                "apply_async": false,
                "arguments": {
                  "mailbox": "{{ vars.item }}",
                  "sender": "{{ vars.input.params.sender }}"
                },
                "workflowReference": "/api/3/workflows/2a41b108-f7cc-51ba-8a10-7b402fef66a5",
                "for_each": {
                  "item": "{{ vars.mailbox_list }}",
                  "parallel": false,
                  "condition": ""
                }
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/74932bdc-b8b6-4d24-88c4-1a4dfbc524f3",
              "group": null,
              "uuid": "a1075d30-bf36-58cd-986d-6ce8e82ad3a1"
            },
            {
              "@type": "WorkflowStep",
              "name": "Notify Caller",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "send_email",
                "config": "",
                "params": {
                  "from": "{{ vars.input.params.notify }}",
                  "body_type": "Rich Text",
                  "to_recipients": "{{ vars.input.params.notify }}",
                  "subject": "Sender sweep finished: {{ vars.input.params.sender }}",
                  "body": "<p>Sender sweep for {{ vars.input.params.sender }} finished. Moved messages per mailbox: {{ vars.steps.Sweep_Each_Mailbox | map(attribute='moved_count') | list | tojson }}.</p>"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Send Email",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "510",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "32668fdb-00f7-5f7e-b6b4-9e792252d115"
            },
            {
              "@type": "WorkflowStep",
              "name": "End",
              "description": null,
              "arguments": {
                "connector": "cyops_utilities",
                "operation": "no_op",
                "config": "",
                "params": {},
                "version": "3.7.3",
                "name": "Utilities",
                "operationTitle": "Utils: No Operation",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "640",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "b868a8e6-c38b-576b-af65-62a5d39662a1"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> Split Mailboxes",
              "targetStep": "/api/3/workflow_steps/51b62536-d5f7-5752-831b-c02657e11992",
              "sourceStep": "/api/3/workflow_steps/ca8701be-a99c-5111-b20c-a5baaee49c02",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "2059a378-8dc4-5bf4-9098-7c86f6f63f62"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Split Mailboxes -> Sweep Each Mailbox",
              "targetStep": "/api/3/workflow_steps/a1075d30-bf36-58cd-986d-6ce8e82ad3a1",
              "sourceStep": "/api/3/workflow_steps/51b62536-d5f7-5752-831b-c02657e11992",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "c4e4753a-6b13-5624-9ef3-2bcaf52b99c4"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Sweep Each Mailbox -> Notify Caller",
              "targetStep": "/api/3/workflow_steps/32668fdb-00f7-5f7e-b6b4-9e792252d115",
              "sourceStep": "/api/3/workflow_steps/a1075d30-bf36-58cd-986d-6ce8e82ad3a1",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "5f85505c-61da-5fa4-87f7-9a8294aa462a"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Notify Caller -> End",
              "targetStep": "/api/3/workflow_steps/b868a8e6-c38b-576b-af65-62a5d39662a1",
              "sourceStep": "/api/3/workflow_steps/32668fdb-00f7-5f7e-b6b4-9e792252d115",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "b0d77757-7b07-5567-b390-077305a67510"
            }
          ],
          "groups": [],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "986d6de9-4df9-5c56-a374-38dc5a9f30bb",
          "isPrivate": false
        },
        {
          "@type": "Workflow",
          "name": "Graph Mail - Sender sweep (one mailbox)",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "Finds every Inbox message from one sender in one mailbox and moves each to Junk Email. Exports moved_count to the parent playbook.",
          "isActive": false,
          "debug": false,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "mailbox",
            "sender"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/e778d09a-d984-5fac-a3a4-827b71646a71",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "mailbox"
                  },
                  {
                    "name": "sender"
                  }
                ],
                "title": "Graph Mail - Sender sweep (one mailbox)",
                "resources": [
                  "alerts"
                ],
                "route": "a5001787-69ca-5133-a920-22af00373330",
                "step_variables": {
                  "input": {
                    "params": {
                      "mailbox": "{{vars.request.data[\"mailbox\"]}}",
                      "sender": "{{vars.request.data[\"sender\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "alerts": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "e778d09a-d984-5fac-a3a4-827b71646a71"
            },
            {
              "@type": "WorkflowStep",
              "name": "Find Sender Mail",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "search_emails",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "source": "Folder Path",
                  "folder_id": "Inbox",
                  "odata_query": "$filter=from/emailAddress/address eq '{{ vars.input.params.sender }}'",
                  "limit": 50,
                  "mark_read": false,
                  "parse_inline": false
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Search Emails",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "a9be08a8-1e59-5341-a341-5d0ebdb96bae"
            },
            {
              "@type": "WorkflowStep",
              "name": "Move Sender Mail",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "move_email",
                "config": "",
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "destination_folder": "Folder Path",
                  "folder_id": "Junk Email",
                  "message_id": "{{ vars.item.id }}"
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Move Email",
                "step_variables": [],
                "pickFromTenant": false,
                "for_each": {
                  "item": "{{ vars.steps.Find_Sender_Mail.data }}",
                  "parallel": false,
                  "condition": ""
                }
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "be573a4c-e8e7-5795-abcd-70ef6dd1d259"
            },
            {
              "@type": "WorkflowStep",
              "name": "Export Count",
              "description": null,
              "arguments": {
                "moved_count": "{{ vars.steps.Find_Sender_Mail.data | length }}",
                "mailbox": "{{ vars.input.params.mailbox }}"
              },
              "status": null,
              "top": "510",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "27f1d5c7-b302-5e60-a6b2-58c25d7a4a70"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> Find Sender Mail",
              "targetStep": "/api/3/workflow_steps/a9be08a8-1e59-5341-a341-5d0ebdb96bae",
              "sourceStep": "/api/3/workflow_steps/e778d09a-d984-5fac-a3a4-827b71646a71",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "831ccfa0-f446-5353-be87-801da95e1662"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Find Sender Mail -> Move Sender Mail",
              "targetStep": "/api/3/workflow_steps/be573a4c-e8e7-5795-abcd-70ef6dd1d259",
              "sourceStep": "/api/3/workflow_steps/a9be08a8-1e59-5341-a341-5d0ebdb96bae",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "8247fb8d-738b-57c6-b249-b95895426390"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Move Sender Mail -> Export Count",
              "targetStep": "/api/3/workflow_steps/27f1d5c7-b302-5e60-a6b2-58c25d7a4a70",
              "sourceStep": "/api/3/workflow_steps/be573a4c-e8e7-5795-abcd-70ef6dd1d259",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "d2726d81-a145-54d9-bb64-74f67a7b5e36"
            }
          ],
          "groups": [],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "2a41b108-f7cc-51ba-8a10-7b402fef66a5",
          "isPrivate": false
        },
        {
          "@type": "Workflow",
          "name": "Purge Reported Phishing Mail",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "Removes a reported phishing message from every mailbox the reporter listed. One child run per mailbox searches the Inbox for the exact subject (search_emails). The matches are gathered into one target list, the run pauses for an approval card showing how many messages matched, and on approval delete_messages_bulk deletes them in one call. Each deletion is reported on its own, so an already-gone copy shows as an error without stopping the others. The outcome is written to the reported alert as a comment through the Graph Security connector (add_alert_comment).\nInputs: approver (who receives the approval card), phishing_subject (the exact subject to match), user_list (comma-separated mailboxes to sweep), alert_id (the alerts_v2 id to comment on). Outputs: outcome (purged, purged_with_errors, not_approved or no_mail_found), deleted_count, error_count, targets.\nScope: the search reads the Inbox of each mailbox (search_emails reads one folder per call). Copies moved to other folders by rules are not matched.\nLive prerequisites: Mail.Read and Mail.ReadWrite on the mailboxes in user_list (application permissions with an application access policy), and SecurityAlert.ReadWrite.All on the Graph Security connector configuration.",
          "isActive": false,
          "debug": true,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "approver",
            "phishing_subject",
            "user_list",
            "alert_id"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/54431862-900f-5e89-aec4-a4d6248f93ce",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "approver"
                  },
                  {
                    "name": "phishing_subject"
                  },
                  {
                    "name": "user_list"
                  },
                  {
                    "name": "alert_id"
                  }
                ],
                "title": "Purge Reported Phishing Mail",
                "resources": [
                  "alerts"
                ],
                "route": "105693f6-4681-503c-b28c-dac89e4e41d2",
                "step_variables": {
                  "input": {
                    "params": {
                      "approver": "{{vars.request.data[\"approver\"]}}",
                      "phishing_subject": "{{vars.request.data[\"phishing_subject\"]}}",
                      "user_list": "{{vars.request.data[\"user_list\"]}}",
                      "alert_id": "{{vars.request.data[\"alert_id\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "alerts": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "54431862-900f-5e89-aec4-a4d6248f93ce"
            },
            {
              "@type": "WorkflowStep",
              "name": "Resolve Inputs",
              "description": null,
              "arguments": {
                "approver": "{{ vars.input.params.approver | default('soc-oncall@example.com', true) }}",
                "phishing_subject": "{{ vars.input.params.phishing_subject | default('Action required: payroll update', true) }}",
                "user_list": "{{ vars.input.params.user_list | default('user1@example.com, user2@example.com', true) }}",
                "alert_id": "{{ vars.input.params.alert_id | default('00000000-0000-0000-0000-000000000b01', true) }}"
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "9401ece1-1c31-5fd1-9438-c55c69bc6265"
            },
            {
              "@type": "WorkflowStep",
              "name": "Split Mailboxes",
              "description": null,
              "arguments": {
                "mailbox_list": "{{ vars.user_list.split(',') | map('trim') | reject('equalto', '') | list }}"
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "cdea18b0-3749-5b4d-825f-5760d7694345"
            },
            {
              "@type": "WorkflowStep",
              "name": "Search Each Mailbox",
              "description": null,
              "arguments": {
                "apply_async": false,
                "arguments": {
                  "mailbox": "{{ vars.item }}",
                  "phishing_subject": "{{ vars.phishing_subject }}"
                },
                "workflowReference": "/api/3/workflows/1fa54b48-e4e2-5cc4-84e5-25b0b0dee067",
                "for_each": {
                  "item": "{{ vars.mailbox_list }}",
                  "parallel": false,
                  "condition": ""
                }
              },
              "status": null,
              "top": "510",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/74932bdc-b8b6-4d24-88c4-1a4dfbc524f3",
              "group": null,
              "uuid": "2e54586b-40b0-5305-bf2a-e55514c06b1f"
            },
            {
              "@type": "WorkflowStep",
              "name": "Collect Targets",
              "description": null,
              "arguments": {
                "purge_targets": "{{ vars.steps.Search_Each_Mailbox | map(attribute='found_targets') | map('default', [], true) | sum(start=[]) }}",
                "found_count": "{{ (vars.steps.Search_Each_Mailbox | map(attribute='found_targets') | map('default', [], true) | sum(start=[])) | length }}"
              },
              "status": null,
              "top": "640",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "10d02fbc-bb8a-54c0-b631-9ec210cd346a"
            },
            {
              "@type": "WorkflowStep",
              "name": "Messages Found",
              "description": null,
              "arguments": {
                "conditions": [
                  {
                    "option": "Matched messages found",
                    "condition": "{{ vars.found_count | int > 0 }}",
                    "step_iri": "/api/3/workflow_steps/4ea14f0d-5378-511d-804e-e0942e678371",
                    "step_name": "Approval"
                  },
                  {
                    "option": "No matched mail",
                    "default": true,
                    "step_iri": "/api/3/workflow_steps/e4ae32f4-f2df-5e92-940a-a5d0d9208477",
                    "step_name": "No Mail Found"
                  }
                ]
              },
              "status": null,
              "top": "770",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/12254cf5-5db7-4b1a-8cb1-3af081924b28",
              "group": null,
              "uuid": "4599dc77-acf5-5527-8aa0-6b6656227769"
            },
            {
              "@type": "WorkflowStep",
              "name": "Approval",
              "description": "The subject search matched {{ vars.found_count }} message(s) across the mailboxes in the sweep. On <b>approve</b> those messages are deleted with one bulk call (each deleted message stays recoverable in the mailbox's Deleted Items). On <b>reject</b> nothing is deleted and the alert records that the purge was not approved.",
              "arguments": {
                "owner_detail": {
                  "isAssigned": false,
                  "externalRecipients": "{{ vars.approver }}"
                },
                "inputInternalUsers": true,
                "unauthenticated_input": true,
                "type": "DecisionBased",
                "input": {
                  "schema": {
                    "title": "Approve purge of '{{ vars.phishing_subject }}' mail?",
                    "description": "The subject search matched {{ vars.found_count }} message(s) across the mailboxes in the sweep. On <b>approve</b> those messages are deleted with one bulk call (each deleted message stays recoverable in the mailbox's Deleted Items). On <b>reject</b> nothing is deleted and the alert records that the purge was not approved.",
                    "inputVariables": []
                  }
                },
                "record": "",
                "is_approval": false,
                "isRecordLinked": false,
                "step_variables": [],
                "response_mapping": {
                  "options": [
                    {
                      "option": "approve",
                      "primary": true,
                      "step_iri": "/api/3/workflow_steps/434fe83d-aeed-5d7f-9508-174fbb67bbe0"
                    },
                    {
                      "option": "reject",
                      "step_iri": "/api/3/workflow_steps/72793726-0d62-500d-979f-3e42fa8da93f"
                    }
                  ],
                  "duplicateOption": false,
                  "customSuccessMessage": "Awaiting Playbook resumed successfully."
                },
                "email_notification": {
                  "enabled": false,
                  "smtpParameters": []
                },
                "inline_channel_list": [],
                "external_channel_list": []
              },
              "status": null,
              "top": "900",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/fc04082a-d7dc-4299-96fb-6837b1baa0fe",
              "group": null,
              "uuid": "4ea14f0d-5378-511d-804e-e0942e678371"
            },
            {
              "@type": "WorkflowStep",
              "name": "Purge Mail",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "delete_messages_bulk",
                "config": "",
                "params": {
                  "user_list": "{{ vars.purge_targets }}"
                },
                "ignore_errors": true,
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Delete Messages (Bulk)",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1030",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "434fe83d-aeed-5d7f-9508-174fbb67bbe0"
            },
            {
              "@type": "WorkflowStep",
              "name": "Purge Checked",
              "description": null,
              "arguments": {
                "conditions": [
                  {
                    "option": "Every matched message was deleted",
                    "condition": "{{ (vars.steps.Purge_Mail.data.Error_List | default([], true)) | length == 0 and (vars.steps.Purge_Mail.data.Message_Deleted_List | default([], true)) | length == vars.found_count | int }}",
                    "step_iri": "/api/3/workflow_steps/cebe41df-3055-5e34-8d3e-8385be758061",
                    "step_name": "Close Out Purged"
                  },
                  {
                    "option": "Some deletions failed or the call failed",
                    "default": true,
                    "step_iri": "/api/3/workflow_steps/52a1a3b2-4bcb-5b48-bdc1-14344da9eeac",
                    "step_name": "Close Out Partial"
                  }
                ]
              },
              "status": null,
              "top": "1160",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/12254cf5-5db7-4b1a-8cb1-3af081924b28",
              "group": null,
              "uuid": "b1c43de7-2f81-51b1-aed6-90854f105cdb"
            },
            {
              "@type": "WorkflowStep",
              "name": "Close Out Purged",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-api-security-v2",
                "operation": "add_alert_comment",
                "config": "",
                "params": {
                  "alertID": "{{ vars.alert_id }}",
                  "comment": "Phishing mail purge (approved): deleted {{ (vars.steps.Purge_Mail.data.Message_Deleted_List | default([], true)) | length }} message(s) matching \"{{ vars.phishing_subject }}\"; 0 deletions failed."
                },
                "version": "4.0.1",
                "name": "Microsoft Graph API Security v2",
                "operationTitle": "Add Alert Comment",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1290",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "cebe41df-3055-5e34-8d3e-8385be758061"
            },
            {
              "@type": "WorkflowStep",
              "name": "Close Out Partial",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-api-security-v2",
                "operation": "add_alert_comment",
                "config": "",
                "params": {
                  "alertID": "{{ vars.alert_id }}",
                  "comment": "Phishing mail purge (approved, partial): deleted {{ (vars.steps.Purge_Mail.data.Message_Deleted_List | default([], true)) | length }} message(s) matching \"{{ vars.phishing_subject }}\"; {{ (vars.steps.Purge_Mail.data.Error_List | default([], true)) | length }} deletion(s) failed and need follow-up (typically already-purged copies answering 404)."
                },
                "version": "4.0.1",
                "name": "Microsoft Graph API Security v2",
                "operationTitle": "Add Alert Comment",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1290",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "52a1a3b2-4bcb-5b48-bdc1-14344da9eeac"
            },
            {
              "@type": "WorkflowStep",
              "name": "Reject Comment",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-api-security-v2",
                "operation": "add_alert_comment",
                "config": "",
                "params": {
                  "alertID": "{{ vars.alert_id }}",
                  "comment": "Phishing mail purge REJECTED at approval: no mail matching \"{{ vars.phishing_subject }}\" was deleted. The report stays with the analyst for follow-up."
                },
                "version": "4.0.1",
                "name": "Microsoft Graph API Security v2",
                "operationTitle": "Add Alert Comment",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1030",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "72793726-0d62-500d-979f-3e42fa8da93f"
            },
            {
              "@type": "WorkflowStep",
              "name": "Purged",
              "description": null,
              "arguments": {
                "outcome": "purged",
                "deleted_count": "{{ (vars.steps.Purge_Mail.data.Message_Deleted_List | default([], true)) | length }}",
                "error_count": 0,
                "targets": "{{ vars.purge_targets }}"
              },
              "status": null,
              "top": "1420",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "e1028a57-7932-5f70-94a6-8c1ef22af9c5"
            },
            {
              "@type": "WorkflowStep",
              "name": "Purged With Errors",
              "description": null,
              "arguments": {
                "outcome": "purged_with_errors",
                "deleted_count": "{{ (vars.steps.Purge_Mail.data.Message_Deleted_List | default([], true)) | length }}",
                "error_count": "{{ (vars.steps.Purge_Mail.data.Error_List | default([], true)) | length }}",
                "targets": "{{ vars.purge_targets }}"
              },
              "status": null,
              "top": "1420",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "785f11c9-f335-53bd-8ca4-1b505bd6c6cf"
            },
            {
              "@type": "WorkflowStep",
              "name": "Not Approved",
              "description": null,
              "arguments": {
                "outcome": "not_approved",
                "deleted_count": 0,
                "error_count": 0,
                "targets": []
              },
              "status": null,
              "top": "1160",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "9f546210-e3fd-554b-9989-7ad75facc5e2"
            },
            {
              "@type": "WorkflowStep",
              "name": "No Mail Found",
              "description": null,
              "arguments": {
                "outcome": "no_mail_found",
                "deleted_count": 0,
                "error_count": 0,
                "targets": []
              },
              "status": null,
              "top": "900",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "e4ae32f4-f2df-5e92-940a-a5d0d9208477"
            },
            {
              "@type": "WorkflowStep",
              "name": "End",
              "description": null,
              "arguments": {
                "connector": "cyops_utilities",
                "operation": "no_op",
                "config": "",
                "params": {},
                "version": "3.7.3",
                "name": "Utilities",
                "operationTitle": "Utils: No Operation",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "1550",
              "left": "540",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "96af932f-36ae-5370-8868-359228ce116c"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> Resolve Inputs",
              "targetStep": "/api/3/workflow_steps/9401ece1-1c31-5fd1-9438-c55c69bc6265",
              "sourceStep": "/api/3/workflow_steps/54431862-900f-5e89-aec4-a4d6248f93ce",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "2237c6be-f504-5ee9-8738-d4940a0cd64a"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Resolve Inputs -> Split Mailboxes",
              "targetStep": "/api/3/workflow_steps/cdea18b0-3749-5b4d-825f-5760d7694345",
              "sourceStep": "/api/3/workflow_steps/9401ece1-1c31-5fd1-9438-c55c69bc6265",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "41bd3b17-9cef-5349-9177-e2ca72ede758"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Split Mailboxes -> Search Each Mailbox",
              "targetStep": "/api/3/workflow_steps/2e54586b-40b0-5305-bf2a-e55514c06b1f",
              "sourceStep": "/api/3/workflow_steps/cdea18b0-3749-5b4d-825f-5760d7694345",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "7f1d8131-7205-54e8-820a-d49ea85a9e65"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Search Each Mailbox -> Collect Targets",
              "targetStep": "/api/3/workflow_steps/10d02fbc-bb8a-54c0-b631-9ec210cd346a",
              "sourceStep": "/api/3/workflow_steps/2e54586b-40b0-5305-bf2a-e55514c06b1f",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "c0becd36-3780-5d8f-a20d-ee5f9647ad6f"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Collect Targets -> Messages Found",
              "targetStep": "/api/3/workflow_steps/4599dc77-acf5-5527-8aa0-6b6656227769",
              "sourceStep": "/api/3/workflow_steps/10d02fbc-bb8a-54c0-b631-9ec210cd346a",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "50fe4100-2453-5578-ac55-0e2f65887781"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Messages Found -> Approval",
              "targetStep": "/api/3/workflow_steps/4ea14f0d-5378-511d-804e-e0942e678371",
              "sourceStep": "/api/3/workflow_steps/4599dc77-acf5-5527-8aa0-6b6656227769",
              "label": "Matched messages found",
              "isExecuted": false,
              "group": null,
              "uuid": "88acdc86-9320-509e-a9c2-cbd0d3c40e6d"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Messages Found -> No Mail Found",
              "targetStep": "/api/3/workflow_steps/e4ae32f4-f2df-5e92-940a-a5d0d9208477",
              "sourceStep": "/api/3/workflow_steps/4599dc77-acf5-5527-8aa0-6b6656227769",
              "label": "No matched mail",
              "isExecuted": false,
              "group": null,
              "uuid": "2cfe1d87-335c-589b-85aa-af67662c67ce"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Approval -> Purge Mail",
              "targetStep": "/api/3/workflow_steps/434fe83d-aeed-5d7f-9508-174fbb67bbe0",
              "sourceStep": "/api/3/workflow_steps/4ea14f0d-5378-511d-804e-e0942e678371",
              "label": "approve",
              "isExecuted": false,
              "group": null,
              "uuid": "13351387-0891-51b4-b740-9564310c0a83"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Approval -> Reject Comment",
              "targetStep": "/api/3/workflow_steps/72793726-0d62-500d-979f-3e42fa8da93f",
              "sourceStep": "/api/3/workflow_steps/4ea14f0d-5378-511d-804e-e0942e678371",
              "label": "reject",
              "isExecuted": false,
              "group": null,
              "uuid": "7de9bc61-a976-5ad2-aae9-e8afcd9f79aa"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Purge Mail -> Purge Checked",
              "targetStep": "/api/3/workflow_steps/b1c43de7-2f81-51b1-aed6-90854f105cdb",
              "sourceStep": "/api/3/workflow_steps/434fe83d-aeed-5d7f-9508-174fbb67bbe0",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "2977f971-162a-572c-8078-26475e88583b"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Purge Checked -> Close Out Purged",
              "targetStep": "/api/3/workflow_steps/cebe41df-3055-5e34-8d3e-8385be758061",
              "sourceStep": "/api/3/workflow_steps/b1c43de7-2f81-51b1-aed6-90854f105cdb",
              "label": "Every matched message was deleted",
              "isExecuted": false,
              "group": null,
              "uuid": "19fa3e9f-df46-582b-bf0c-22595a1c6621"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Purge Checked -> Close Out Partial",
              "targetStep": "/api/3/workflow_steps/52a1a3b2-4bcb-5b48-bdc1-14344da9eeac",
              "sourceStep": "/api/3/workflow_steps/b1c43de7-2f81-51b1-aed6-90854f105cdb",
              "label": "Some deletions failed or the call failed",
              "isExecuted": false,
              "group": null,
              "uuid": "69723f20-971b-5733-90bc-74e1da53f8f4"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Close Out Purged -> Purged",
              "targetStep": "/api/3/workflow_steps/e1028a57-7932-5f70-94a6-8c1ef22af9c5",
              "sourceStep": "/api/3/workflow_steps/cebe41df-3055-5e34-8d3e-8385be758061",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "d1adcf9c-cba1-5393-ae1d-f184c0b61357"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Close Out Partial -> Purged With Errors",
              "targetStep": "/api/3/workflow_steps/785f11c9-f335-53bd-8ca4-1b505bd6c6cf",
              "sourceStep": "/api/3/workflow_steps/52a1a3b2-4bcb-5b48-bdc1-14344da9eeac",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "0168daed-a0d4-5e94-b0c0-b54ec0c29454"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Reject Comment -> Not Approved",
              "targetStep": "/api/3/workflow_steps/9f546210-e3fd-554b-9989-7ad75facc5e2",
              "sourceStep": "/api/3/workflow_steps/72793726-0d62-500d-979f-3e42fa8da93f",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "9ae86de7-4fb7-56ef-8cd6-6642109138a6"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Purged -> End",
              "targetStep": "/api/3/workflow_steps/96af932f-36ae-5370-8868-359228ce116c",
              "sourceStep": "/api/3/workflow_steps/e1028a57-7932-5f70-94a6-8c1ef22af9c5",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "b939ca07-790f-5951-b106-db4f4edb1d54"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Purged With Errors -> End",
              "targetStep": "/api/3/workflow_steps/96af932f-36ae-5370-8868-359228ce116c",
              "sourceStep": "/api/3/workflow_steps/785f11c9-f335-53bd-8ca4-1b505bd6c6cf",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "9b4ebfa7-4321-50b7-a125-bcfa425d3458"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Not Approved -> End",
              "targetStep": "/api/3/workflow_steps/96af932f-36ae-5370-8868-359228ce116c",
              "sourceStep": "/api/3/workflow_steps/9f546210-e3fd-554b-9989-7ad75facc5e2",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "85889b44-e4c0-5723-9c68-c15e3b86e36e"
            },
            {
              "@type": "WorkflowRoute",
              "name": "No Mail Found -> End",
              "targetStep": "/api/3/workflow_steps/96af932f-36ae-5370-8868-359228ce116c",
              "sourceStep": "/api/3/workflow_steps/e4ae32f4-f2df-5e92-940a-a5d0d9208477",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "c0418a58-46c9-5529-9fdc-03627d977678"
            }
          ],
          "groups": [
            {
              "@type": "WorkflowGroup",
              "name": "Note: Collect Targets",
              "description": "Each child run exports its matches as found_targets ({user_id, message_id} pairs). A child that failed exports nothing and contributes no targets.",
              "type": "note",
              "isCollapsed": false,
              "hasTriggerStep": false,
              "hideInLogs": true,
              "metadata": [],
              "reusable": false,
              "top": "640",
              "left": "540",
              "height": "116",
              "width": "440",
              "uuid": "42b51e19-04a8-5f06-94c5-e987292fd320",
              "recordTags": []
            },
            {
              "@type": "WorkflowGroup",
              "name": "Note: Purge Mail",
              "description": "One call for every mailbox: the op deletes each {user_id, message_id} pair and reports each failure in Error_List. A 404 (the copy was already gone) is a normal outcome for phishing sweeps and does not fail the run.",
              "type": "note",
              "isCollapsed": false,
              "hasTriggerStep": false,
              "hideInLogs": true,
              "metadata": [],
              "reusable": false,
              "top": "1036",
              "left": "880",
              "height": "138",
              "width": "440",
              "uuid": "317201b7-195b-5ccc-b210-568816a71a3f",
              "recordTags": []
            },
            {
              "@type": "WorkflowGroup",
              "name": "Note: Close Out Partial",
              "description": "A partial purge is still a purge: the comment says how many deletions failed so a person can chase the stragglers (usually copies that were already gone).",
              "type": "note",
              "isCollapsed": false,
              "hasTriggerStep": false,
              "hideInLogs": true,
              "metadata": [],
              "reusable": false,
              "top": "1290",
              "left": "880",
              "height": "116",
              "width": "440",
              "uuid": "096bccbb-fa8f-5496-a770-7578ebb54a10",
              "recordTags": []
            },
            {
              "@type": "WorkflowGroup",
              "name": "Note: No Mail Found",
              "description": "Nothing matched the subject in any reported mailbox: the sweep ran and the answer is \"already gone\". The run outcome says so; no alert comment is written.",
              "type": "note",
              "isCollapsed": false,
              "hasTriggerStep": false,
              "hideInLogs": true,
              "metadata": [],
              "reusable": false,
              "top": "900",
              "left": "880",
              "height": "116",
              "width": "440",
              "uuid": "5750979b-7c89-5219-a795-7521bcb49022",
              "recordTags": []
            }
          ],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "87fe5495-adbc-5352-bfdc-a85aad80cfb1",
          "isPrivate": false
        },
        {
          "@type": "Workflow",
          "name": "Purge Reported Phishing Mail - Search (one mailbox)",
          "aliasName": null,
          "tag": "",
          "recordTags": [],
          "description": "Finds every Inbox message in one mailbox whose subject matches exactly and exports the {user_id, message_id} pairs to the parent purge run. A search error exports no targets so one broken mailbox does not stop the sweep of the others.",
          "isActive": false,
          "debug": false,
          "singleRecordExecution": false,
          "remoteExecutableFlag": 0,
          "parameters": [
            "mailbox",
            "phishing_subject"
          ],
          "synchronous": false,
          "triggerStep": "/api/3/workflow_steps/b7ccabc6-a834-5b41-b0b6-58de774110d8",
          "steps": [
            {
              "@type": "WorkflowStep",
              "name": "Start",
              "description": null,
              "arguments": {
                "inputVariables": [
                  {
                    "name": "mailbox"
                  },
                  {
                    "name": "phishing_subject"
                  }
                ],
                "title": "Purge Reported Phishing Mail - Search (one mailbox)",
                "resources": [
                  "alerts"
                ],
                "route": "4ed7a046-89e2-5cf3-abc6-1642a2ab5d35",
                "step_variables": {
                  "input": {
                    "params": {
                      "mailbox": "{{vars.request.data[\"mailbox\"]}}",
                      "phishing_subject": "{{vars.request.data[\"phishing_subject\"]}}"
                    },
                    "records": "{{vars.input.records}}"
                  }
                },
                "triggerOnSource": true,
                "triggerOnReplicate": false,
                "noRecordExecution": true,
                "singleRecordExecution": false,
                "__triggerLimit": true,
                "executeButtonText": "Execute",
                "showToasterMessage": {
                  "visible": false,
                  "messageVisible": true
                },
                "displayConditions": {
                  "alerts": {
                    "sort": [],
                    "limit": 30,
                    "logic": "AND",
                    "filters": []
                  }
                }
              },
              "status": null,
              "top": "120",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/f414d039-bb0d-4e59-9c39-a8f1e880b18a",
              "group": null,
              "uuid": "b7ccabc6-a834-5b41-b0b6-58de774110d8"
            },
            {
              "@type": "WorkflowStep",
              "name": "Find Subject Mail",
              "description": null,
              "arguments": {
                "connector": "microsoft-graph-mail-v2",
                "operation": "search_emails",
                "config": "",
                "ignore_errors": true,
                "params": {
                  "user_id": "{{ vars.input.params.mailbox }}",
                  "source": "Folder Path",
                  "folder_id": "Inbox",
                  "odata_query": "$filter=subject eq '{{ vars.input.params.phishing_subject | replace(\"'\", \"''\") }}'",
                  "limit": 50,
                  "mark_read": false,
                  "parse_inline": false
                },
                "version": "3.0.2",
                "name": "Microsoft Graph Mail v2",
                "operationTitle": "Search Emails",
                "step_variables": [],
                "pickFromTenant": false
              },
              "status": null,
              "top": "250",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/0bfed618-0316-11e7-93ae-92361f002671",
              "group": null,
              "uuid": "aba94595-0580-5b48-b4e2-9b6cd91d560a"
            },
            {
              "@type": "WorkflowStep",
              "name": "Build Targets",
              "description": null,
              "arguments": {
                "connector": "code-snippet",
                "operation": "python_inline_code_editor",
                "operationTitle": "Execute Python Code",
                "version": "2.1.4",
                "step_variables": [],
                "params": {
                  "python_function": "targets = []\n{% for message in vars.steps.Find_Subject_Mail.data | default([], true) %}\ntargets.append({\"user_id\": {{ vars.input.params.mailbox | tojson }}, \"message_id\": {{ message.id | tojson }}})\n{% endfor %}\nprint({\"targets\": targets, \"found\": len(targets)})\n"
                },
                "config": ""
              },
              "status": null,
              "top": "380",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/1fdd14cc-d6b4-4335-a3af-ab49c8ed2fd8",
              "group": null,
              "uuid": "c2486d5c-d878-521f-a5cb-fc090300ebb0"
            },
            {
              "@type": "WorkflowStep",
              "name": "Export Targets",
              "description": null,
              "arguments": {
                "found_targets": "{{ vars.steps.Build_Targets.data.code_output.targets | default([], true) }}",
                "mailbox": "{{ vars.input.params.mailbox }}"
              },
              "status": null,
              "top": "510",
              "left": "200",
              "stepType": "/api/3/workflow_step_types/04d0cf46-b6a8-42c4-8683-60a7eaa69e8f",
              "group": null,
              "uuid": "c9ea78f5-2bec-5a70-a7e0-61596e8fd70c"
            }
          ],
          "routes": [
            {
              "@type": "WorkflowRoute",
              "name": "Start -> Find Subject Mail",
              "targetStep": "/api/3/workflow_steps/aba94595-0580-5b48-b4e2-9b6cd91d560a",
              "sourceStep": "/api/3/workflow_steps/b7ccabc6-a834-5b41-b0b6-58de774110d8",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "8431b52b-4603-592f-aaf2-da659c31748f"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Find Subject Mail -> Build Targets",
              "targetStep": "/api/3/workflow_steps/c2486d5c-d878-521f-a5cb-fc090300ebb0",
              "sourceStep": "/api/3/workflow_steps/aba94595-0580-5b48-b4e2-9b6cd91d560a",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "52f0197a-d342-5750-9e33-3ff332d0778b"
            },
            {
              "@type": "WorkflowRoute",
              "name": "Build Targets -> Export Targets",
              "targetStep": "/api/3/workflow_steps/c9ea78f5-2bec-5a70-a7e0-61596e8fd70c",
              "sourceStep": "/api/3/workflow_steps/c2486d5c-d878-521f-a5cb-fc090300ebb0",
              "label": null,
              "isExecuted": false,
              "group": null,
              "uuid": "4334483d-b157-5bfb-9064-f2c1a849732f"
            }
          ],
          "groups": [
            {
              "@type": "WorkflowGroup",
              "name": "Note: Build Targets",
              "description": "The snippet body is a Jinja template: its for-loops emit one append per matched message, so the Python source holds only literals and no imports.",
              "type": "note",
              "isCollapsed": false,
              "hasTriggerStep": false,
              "hideInLogs": true,
              "metadata": [],
              "reusable": false,
              "top": "380",
              "left": "540",
              "height": "116",
              "width": "440",
              "uuid": "9db788b8-4b94-5d42-819e-304d1640adf3",
              "recordTags": []
            }
          ],
          "priority": "/api/3/picklists/9e8d41e4-8ada-4a2c-bd02-07f62c6d0a00",
          "isEditable": true,
          "uuid": "1fa54b48-e4e2-5cc4-84e5-25b0b0dee067",
          "isPrivate": false
        }
      ]
    }
  ]
}
