Package Information
Available Nodes
Documentation
n8n-nodes-civic-decision
This custom node for n8n provides various decision-making methods for civic tech platforms. The Decision node takes multiple inputs (votes) and determines whether a decision passes based on different decision-making methods.
Installation
Option 1: npm installation (recommended)
Install the package in your n8n installation:
npm install n8n-nodes-civic-decision
Restart your n8n instance.
Option 2: Manual installation
Alternatively, you can manually install the node:
- Clone this repository
- Copy the
nodes/Decision
folder to your n8n custom nodes directory (typically~/.n8n/custom/
) - Restart your n8n instance
Features
The Decision node supports the following decision-making methods:
Simple Majority
A decision passes if there are more "Yes" votes than "No" votes. Abstentions are not counted.
Threshold
A decision passes if the "Yes" votes meet or exceed a specified threshold. The threshold can be:
- Percentage: A percentage of valid votes (excluding abstentions)
- Absolute: An absolute number of "Yes" votes
Consensus
A decision passes if the percentage of blocking votes ("No" votes) is below a specified blocking percentage. This implements a form of consensus decision-making where a small minority cannot block a decision.
Custom Logic
Define custom conditions for when a decision passes using JavaScript expressions. Available variables:
yesVotes
: Number of "Yes" votesnoVotes
: Number of "No" votesabstainVotes
: Number of abstention votestotalVotes
: Total number of votes
Example: yesVotes > noVotes * 2
(passes if there are at least twice as many "Yes" votes as "No" votes)
Usage
- Add the Decision node to your workflow
- Connect it to a source of vote data (e.g., Airtable, Google Sheets, or an API)
- Configure the node:
- Select a decision method
- Specify the field name containing votes and values for "Yes", "No", and "Abstain"
- Configure method-specific parameters
- Connect the outputs:
- First output: Decision passes
- Second output: Decision fails
Example
Here's a simple example workflow:
- HTTP Request node: Triggers the workflow when votes are submitted
- Function node: Formats the votes from various sources
- Decision node: Applies the selected decision method
- If Decision Passes: Send confirmation, update records, etc.
- If Decision Fails: Notify stakeholders, archive proposal, etc.
Inputs
The Decision node expects input items with a field containing vote values. The field name and values are configurable.
Outputs
The Decision node has two outputs:
- Decision Passed: Activated when the decision passes
- Decision Failed: Activated when the decision fails
Both outputs include a summary object with:
- Method used
- Total votes
- Yes votes
- No votes
- Abstain votes
- Result (PASSED/FAILED)
- Method-specific information (threshold, blocking percentage, etc.)
License
MIT