n8n Integration
Package: BASIC
1. General
n8n is an open-source automation platform that can be used to connect external systems and services with one another – without programming knowledge, but with the option of including your own code where required. brainX provides an official Community Node verified by n8n, through which brainX can be integrated directly into n8n workflows.
A step-by-step description of the n8n integration is available in the video brainX + n8n: How every landing page lead lands straight in the CRM | Deep Dive Part 7 on the brainX YouTube channel. The example workflow shown in the video is available for download in the video description.
2. brainX Community Node in n8n
The brainX Community Node is officially verified by n8n and is actively maintained by brainX. It can be found in n8n under Integrations → search for “brainX".
The node mirrors the capabilities of the brainX REST API in a user-friendly, no-code-compatible form and makes it possible to read, create, update and link brainX records from within n8n.
3. Authentication (Credentials)
The connection between n8n and brainX is established via Credentials in n8n. The following details are required:
- Base URL – the URL of the brainX instance (e.g.
https://meine-brainx-domain) - Username – the username with which the user logs in to brainX
- API password – a specially generated API password (not the normal login password)
The API password is generated in brainX under My Settings and is intended exclusively for API access. It is not the same as the user's login password. Further information on generating the API password can be found on the REST API page.
After entering the credentials, the connection can be checked in n8n via Test Connection.
4. Available Operations
The brainX node supports the following operations:
4.1. Search
Searches for records in a selectable module based on one or more filters.
Configurable options:
- Module – the module to be searched (e.g. Leads, Contacts, Deals)
- Limit – maximum number of returned records
- Filter – one or more filter criteria; combined with AND by default
- Filter Combine With OR – combines the filters with OR instead of AND
- Fields to Return – restricts the returned fields; by default the standard fields are returned
- Include Deleted – also returns records that are still in the Recycle Bin
- Always Output Data – also returns an empty array when the result is empty (recommended when the result is evaluated in a downstream condition)
The Always Output Data option should be enabled if the search result is evaluated in a downstream IF node – only then is an empty array returned when there is no match, which the condition can then evaluate correctly.
4.2. Create
Creates a new record in a selectable module. All fields of the module are available – including custom fields that have been created in the respective brainX instance.
Fields can be populated with static values or with dynamic values from previous node outputs.
The full newly created record is returned as the response, including the automatically assigned record ID.
4.3. Update
Updates an existing record. Works in the same way as the Create operation, but additionally requires the Record ID of the record to be updated.
Only the fields that are explicitly specified are updated – existing field values that are not passed remain unchanged.
4.4. Get
Retrieves a single record by its ID and returns all fields of the record.
Used when the ID of a record is already known and the full details are required.
4.5. Add Relations
Links two records with one another. This operation is used exclusively for modules that are linked to each other via the Relations tab in brainX (e.g. Leads ↔ Campaigns, Leads ↔ Documents).
The difference between Add Relations and Create/Update:
- Add Relations → for links where both modules display the respective other record in the Relations tab (n:m relationship)
- Create/Update → for all other fields that appear as a relation field in the detail view (e.g. a contact assigned to a lead)
Configuration:
- Record ID – the ID of the record to which the link is to be added
- Related Record ID – the ID of the record to be linked
A status 200 with the message OK is returned as the response.
4.6. Get Current User
Returns the details of the user whose credentials are used for the connection.
4.7. Get Companies
Returns the tenants that the current user has access to. Relevant for brainX instances with multi-tenancy.
4.8. Custom API Call
Enables the direct calling of any brainX REST API endpoints for special cases that are not covered by the node's standard operations.
Available HTTP methods: GET, PATCH, POST, DELETE
Configuration:
- Endpoint – the desired API endpoint
- Body – optional JSON body for POST and PATCH requests
5. Practical Example: Creating a Landing Page Lead in brainX
The following example shows the structure of a typical n8n workflow that creates or updates a lead from a contact form in brainX.
Structure of the workflow:
- Webhook – receives the form data (first name, last name, email, company, phone) via HTTP POST
- Search (Module: Leads) – uses the email address to check whether the lead already exists in brainX
- Limit: 1
- Always Output Data: enabled
- IF node – evaluates the search result:
- Result not empty → lead already exists → Update branch
- Result empty → new lead → Create branch
- Create (Module: Leads) – creates a new lead; populates fields from the webhook request as well as static fields (e.g. Source = Website, Status = New)
- Update (Module: Leads) – updates the existing lead with the new form data
- Add Relations – links the lead with a campaign (Record ID of the lead from the Create or Search result; Related Record ID of the campaign)
Webhooks should always be secured with header authentication (Header Auth) in order to prevent unauthorised requests from external sources.
6. Determining the Campaign ID
The ID of a campaign can be determined in two ways:
- Directly from brainX: In the detail view of the campaign, the record ID is contained in the page URL.
- Via a Get or Search operation in n8n: A brainX node with the Get operation (Module: Campaigns) returns all campaigns with their IDs. With Search, a specific campaign can be searched for in a targeted manner.