# Delete All Swift Users From Group

## Overview

<table id="bkmrk-fieldvalue-workflow-"><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td>Workflow ID</td><td>l0KQdZd8IGiJNuLa</td></tr><tr><td>n8n URL</td><td>[https://n8n.pbr.org.au/workflow/l0KQdZd8IGiJNuLa](https://n8n.pbr.org.au/workflow/l0KQdZd8IGiJNuLa)</td></tr><tr><td>Status</td><td>Inactive — manual execution only</td></tr><tr><td>Trigger</td><td>Manual (Execute Workflow button in n8n)</td></tr><tr><td>Systems</td><td>Swift Digital</td></tr></tbody></table>

---

## Purpose

This is a utility workflow used to bulk-delete all contacts from a specified Swift Digital contact group. It is not scheduled and must be manually executed. Before running, the target group ID must be set in the n8n Global Constants node.

**Warning:** This workflow calls the Swift Digital contact DELETE API, which permanently removes the contacts from Swift Digital entirely — it does not merely remove them from the group. Use with care.

---

## How It Works

1. **Manual trigger** — workflow is started manually from within n8n.
2. **Global Constants** — reads the target group ID(s) from the n8n Global Constants node. The `constants` field is expected to contain one or more group IDs.
3. **Split Out group IDs** — if multiple group IDs are present in constants, they are split into individual items for iteration.
4. **Get Users in Group** — calls `GET https://v3.api.swiftdigital.com.au/request/mailhouse/mailgroup/readmembers` with the group ID to retrieve all contact IDs in the group.
5. **Split Out contact IDs** — splits the returned array of contact IDs into individual items.
6. **Remove Users from Swift** — calls `DELETE https://v3.api.swiftdigital.com.au/request/mailhouse/contact/delete` for each contact ID, permanently deleting them from Swift Digital.

---

## Usage Instructions

1. Open the workflow in n8n: [https://n8n.pbr.org.au/workflow/l0KQdZd8IGiJNuLa](https://n8n.pbr.org.au/workflow/l0KQdZd8IGiJNuLa)
2. Open the **Global Constants** node and set the `constants` value to the Swift Digital group ID(s) you want to clear.
3. Save the workflow.
4. Click **Execute Workflow**.
5. Monitor the execution to confirm all contacts were removed.

Do not activate (publish) this workflow. It should always remain inactive and only be run on demand.

---

## Nodes

<table id="bkmrk-nodetypepurpose-when"><thead><tr><th>Node</th><th>Type</th><th>Purpose</th></tr></thead><tbody><tr><td>When clicking Execute workflow</td><td>Manual Trigger</td><td>Entry point — started manually only</td></tr><tr><td>Global Constants</td><td>Global Constants</td><td>Provides the target group ID(s)</td></tr><tr><td>Split Out1</td><td>Split Out (`constants`)</td><td>Iterates over group IDs if multiple are configured</td></tr><tr><td>Get Users in Group</td><td>HTTP Request (GET)</td><td>Retrieves all contact IDs in the target group from Swift Digital</td></tr><tr><td>Split Out</td><td>Split Out (`contact_ids`)</td><td>Splits the contact ID array into individual items</td></tr><tr><td>Remove Users from Swift</td><td>HTTP Request (DELETE)</td><td>Permanently deletes each contact from Swift Digital</td></tr></tbody></table>

---

## Credentials

<table id="bkmrk-credentialtypeused-f"><thead><tr><th>Credential</th><th>Type</th><th>Used For</th></tr></thead><tbody><tr><td>Swift Digital OAuth2</td><td>OAuth2</td><td>All Swift Digital API calls</td></tr></tbody></table>

---

## Maintenance Notes

- This workflow must remain **inactive** at all times. Do not publish it.
- The target group ID must be manually set in Global Constants before each run — it is not persisted between executions.
- This workflow deletes contacts from Swift Digital entirely, not just from a group. Ensure this is the intended behaviour before running. If you only need to remove contacts from a group without deleting them, the Swift Digital API endpoint `/request/mailhouse/mailgroup/removemembers` should be used instead — this would require a workflow modification.
- The BetterImpact &gt; Swift User Ingest workflow will re-create contacts on its next run if the deleted users still exist as active members in BetterImpact. This workflow is therefore typically used to reset a group before a clean resync.