n8n-nodes-captain
v1.2.0
Published
n8n community nodes for the Captain customer data platform
Maintainers
Readme
n8n-nodes-captain
Community nodes for integrating n8n with the Captain customer data platform (CDP). The package provides 27 nodes for messaging, segmentation, user data, events, products and vouchers.
Requirements
- A self-hosted n8n instance
- A Captain CDP instance with a Server-Side Token
Installation
From the n8n GUI
- Go to Settings > Community Nodes.
- Select Install.
- Enter
n8n-nodes-captainand confirm the risk notice. - Restart n8n if it does not restart automatically.
This package is an unverified community node. Installing it requires accepting the community node risk notice, which is available on self-hosted instances only.
Manual installation (npm)
Use this method for Docker, queue mode or private deployments. Run it inside the n8n environment:
mkdir -p ~/.n8n/nodes
cd ~/.n8n/nodes
npm install n8n-nodes-captainThen restart n8n. In queue mode, repeat the installation on every worker.
If npm tries to compile native dependencies from the n8n-workflow peer dependency, install with npm install --legacy-peer-deps n8n-nodes-captain. n8n provides n8n-workflow at runtime, so the peer copy is not needed.
Managed by environment variables
On n8n 2.21.0 and later you can provision the package through environment variables:
N8N_COMMUNITY_PACKAGES_MANAGED_BY_ENV=true
N8N_COMMUNITY_PACKAGES='[{"name":"n8n-nodes-captain","version":"1.0.0"}]'Unverified packages additionally require N8N_UNVERIFIED_PACKAGES_ENABLED=true or a pinned checksum.
Credentials
The nodes authenticate with a Captain API credential. Create it once per Captain instance under Credentials and select it in the nodes.
The Access Token is the project's Server-Side Token (not the SERVER_SIDE_TOKEN_SECRET). It is generated when the project is initialized and can be copied from the dashboard under Settings > API & Security > Server-Side Token.
| Field | Description |
| --- | --- |
| CDP Base URL | Root URL of the Captain instance, for example https://cdp.example.com, without a trailing slash |
| Access Token | Server-Side Token from the dashboard, sent as a Bearer token |
| Event Trigger Token | Bearer token that incoming event webhooks must present — use the project Server-Side Token (falls back to the Access Token when empty) |
The credential supports the Test button, which verifies the base URL and access token against the campaigns endpoint.
Environment variable fallback
For existing deployments that configure nodes through environment variables, every setting falls back to the environment when the credential field is empty:
| Setting | Environment variable | Default |
| --- | --- | --- |
| CDP Base URL | CDP_URL | - |
| Access Token | UNEXO_API_KEY | - |
| Request timeout | REQ_TIMEOUT | 60000 ms |
| Message timeout | MESSAGE_TIMEOUT | 300000 ms |
Values from the credential always take precedence over environment variables.
Nodes
Messaging
| Node | Description |
| --- | --- |
| Captain - Send SMS (Advanced) | Sends an SMS campaign to the input users |
| Captain - Send Email (Advanced) | Sends an email campaign with personalized subject, preview and content |
| Captain - Send WhatsApp (Advanced) | Sends a WhatsApp campaign; supports rotary mode, file attachments and tags |
| Captain - Send WebPush (Advanced) | Sends a web push campaign with title, body, icon, image and action buttons |
| Captain - Send BaleMessage (Advanced) | Sends a Bale messenger campaign |
| Captain - Send Content | Sends content to a segment through SMS, WhatsApp, Web Push, Email or Bale |
| Captain - One Time Send Content | Sends content to a segment once per user |
| Captain - Ask ChatGPT | Sends a per-user prompt to the Captain GPT endpoint and stores the answer in outputResult.chatGpt |
Audience and segmentation
| Node | Description | | --- | --- | | Captain - Get Segment Users | Fetches the users of a segment, or applies a custom filter rule; can attach the latest events | | Captain - User Update | Updates user fields and attributes using n8n expressions | | Captain - Add/Remove Tags | Adds or removes tags for the input users | | Captain - Check Tags | Splits users by whether they have any of the selected tags | | Captain - Check User Conditions | Splits users by a conditions rule | | Captain - Check If Sent | Splits users by whether content was sent | | Captain - Check Link Click | Splits users by their SMS or email link click status | | Captain - Has Done | Splits users by whether they performed an event within a time range | | Captain - AB Test | Splits users into two groups based on a percentage | | Captain - Best Channel | Routes users by their first, second or third best channel (8 outputs) | | Captain - Send To Call Center | Adds users to a call center category or removes them from it | | Captain - Coupon Code | Assigns coupons from a voucher pool to the input users | | Captain - User Name Formatter | Builds display names from first and last name, with configurable suffixes |
Events and products
| Node | Description | | --- | --- | | Captain - Events | Retrieves the last event, last cart or recommended purchases for the input users | | Captain - Event Trigger | Triggers the workflow when Captain sends an event (Bearer token authentication) | | Captain - Get Product Info | Retrieves product information for the input users | | Captain - Items | Fetches consumable or discounted items | | Captain - Product Available | Triggers the workflow when a product becomes available | | Captain - Remove Users From Notify Product Available | Removes product availability notification events for the input users |
Example
A typical workflow:
- Captain - Get Segment Users selects a segment and returns its users.
- Captain - User Name Formatter prepares a display name for each user.
- Captain - Send SMS (Advanced) sends a personalized message. The message field supports expressions such as
{{ $json.outputResult.name }}.
Nodes that send messages can wait until Captain reports that all messages were sent before continuing. Sending nodes return a per-user outputResult object that describes what happened, and failures are returned as items instead of failing the whole workflow.
Development
npm install
npm run build # compile nodes and copy assets into dist/
npm run lint # run the n8n community node linter
npm run dev # start a local n8n instance with the nodes loaded
npm run release # lint, build and publish a new versionProject layout:
credentials/ credential types
nodes/ one folder per node, plus shared helpers in nodes/shared
dist/ build output that is published to npmThe package has no runtime dependencies; n8n-workflow is provided by n8n.
