@ixiam/n8n-nodes-civicrm 1.1.29 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/credentials/CiviCrmApi.credentials.ts +8 -7
- package/debug-auth.js +94 -0
- package/dist/credentials/CiviCrmApi.credentials.js +8 -8
- package/dist/{index.js → src/index.js} +1 -1
- package/dist/{nodes → src/nodes}/CiviCrm/CiviCrm.node.js +32 -0
- package/dist/src/nodes/CiviCrm/descriptions/generic.js +11 -0
- package/dist/{nodes → src/nodes}/CiviCrm/descriptions/resources.js +2 -0
- package/dist/{nodes → src/nodes}/transport/GenericFunctions.js +1 -1
- package/package.json +3 -3
- package/{index.ts → src/index.ts} +1 -1
- package/{nodes → src/nodes}/CiviCrm/CiviCrm.node.ts +33 -0
- package/src/nodes/CiviCrm/descriptions/generic.ts +9 -0
- package/{nodes → src/nodes}/CiviCrm/descriptions/resources.ts +2 -0
- package/{nodes → src/nodes}/transport/GenericFunctions.ts +1 -1
- package/tsconfig.json +1 -2
- package/dist/nodes/CiviCrm/descriptions/generic.js +0 -11
- package/nodes/CiviCrm/descriptions/generic.ts +0 -9
- package/temp_civigo/package/LICENSE.md +0 -19
- package/temp_civigo/package/README.md +0 -34
- package/temp_civigo/package/package.json +0 -59
- /package/dist/{nodes → src/nodes}/CiviCrm/civicrm.svg +0 -0
- /package/{nodes → src/nodes}/CiviCrm/civicrm.svg +0 -0
|
@@ -12,16 +12,16 @@ export class CiviCrmApi implements ICredentialType {
|
|
|
12
12
|
|
|
13
13
|
properties: INodeProperties[] = [
|
|
14
14
|
{
|
|
15
|
-
displayName: 'URL',
|
|
16
|
-
name: '
|
|
15
|
+
displayName: 'Base URL',
|
|
16
|
+
name: 'baseUrl',
|
|
17
17
|
type: 'string',
|
|
18
18
|
default: '',
|
|
19
19
|
placeholder: 'https://example.org/civicrm',
|
|
20
20
|
required: true,
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
displayName: 'API
|
|
24
|
-
name: '
|
|
23
|
+
displayName: 'API Token',
|
|
24
|
+
name: 'apiToken',
|
|
25
25
|
type: 'string',
|
|
26
26
|
typeOptions: {
|
|
27
27
|
password: true,
|
|
@@ -35,15 +35,14 @@ export class CiviCrmApi implements ICredentialType {
|
|
|
35
35
|
type: 'generic' as const,
|
|
36
36
|
properties: {
|
|
37
37
|
headers: {
|
|
38
|
-
|
|
38
|
+
'X-Civi-Auth': '={{ "Bearer " + $credentials.apiToken }}',
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
test: ICredentialTestRequest = {
|
|
44
44
|
request: {
|
|
45
|
-
|
|
46
|
-
url: '/civicrm/ajax/api4/Contact/get',
|
|
45
|
+
url: '={{ $credentials.baseUrl }}/civicrm/ajax/api4/Contact/get',
|
|
47
46
|
method: 'POST',
|
|
48
47
|
body: {
|
|
49
48
|
version: 4,
|
|
@@ -54,3 +53,5 @@ export class CiviCrmApi implements ICredentialType {
|
|
|
54
53
|
},
|
|
55
54
|
};
|
|
56
55
|
}
|
|
56
|
+
|
|
57
|
+
export const civiCrmApi = CiviCrmApi;
|
package/debug-auth.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
|
|
2
|
+
const https = require('https');
|
|
3
|
+
|
|
4
|
+
const config = {
|
|
5
|
+
url: 'https://smaster.demo.civicrm.org',
|
|
6
|
+
apiKey: 'Q{12XT/su[+W'
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const requestBody = JSON.stringify({
|
|
10
|
+
version: 4,
|
|
11
|
+
select: ['id'],
|
|
12
|
+
limit: 1
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const options = {
|
|
16
|
+
hostname: 'smaster.demo.civicrm.org',
|
|
17
|
+
path: '/civicrm/ajax/api4/Contact/get',
|
|
18
|
+
method: 'POST',
|
|
19
|
+
headers: {
|
|
20
|
+
'Authorization': `Bearer ${config.apiKey}`,
|
|
21
|
+
'Content-Type': 'application/x-www-form-urlencoded', // Based on CiviCrmApi.credentials.ts? No, wait.
|
|
22
|
+
// In CiviCrmApi.credentials.ts, we see:
|
|
23
|
+
// headers: { Authorization: ... }
|
|
24
|
+
// BUT GenericFunctions.ts says: 'Content-Type': 'application/x-www-form-urlencoded'
|
|
25
|
+
// AND body: { params: JSON.stringify(body) }
|
|
26
|
+
|
|
27
|
+
// HOWEVER, the `test` property in CiviCrmApi.credentials.ts does NOT go through GenericFunctions.
|
|
28
|
+
// It's a standard n8n credential test request.
|
|
29
|
+
// It defines:
|
|
30
|
+
// request: { ... method: 'POST', body: { ... } }
|
|
31
|
+
// n8n by default sends JSON if body is an object? Or form-urlencoded?
|
|
32
|
+
// Let's check CiviCrmApi.credentials.ts again.
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Re-checking the credential definition:
|
|
37
|
+
/*
|
|
38
|
+
authenticate = {
|
|
39
|
+
type: 'generic' as const,
|
|
40
|
+
properties: {
|
|
41
|
+
headers: {
|
|
42
|
+
Authorization: 'Bearer ={{$credentials.apiKey}}',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
test: ICredentialTestRequest = {
|
|
47
|
+
request: {
|
|
48
|
+
...
|
|
49
|
+
body: {
|
|
50
|
+
version: 4,
|
|
51
|
+
select: ['id'],
|
|
52
|
+
limit: 1,
|
|
53
|
+
},
|
|
54
|
+
*/
|
|
55
|
+
// It does NOT specify a Content-Type in the `test` request. N8n defaults to JSON for object bodies usually.
|
|
56
|
+
// BUT GenericFunctions.ts explicitly sets 'Content-Type': 'application/x-www-form-urlencoded'.
|
|
57
|
+
// Maybe the test request fails because it sends JSON but CiviCRM expects form-urlencoded with `params`?
|
|
58
|
+
// OR it expects JSON?
|
|
59
|
+
// The user said "it works in the previous version".
|
|
60
|
+
// The previous version had the SAME credential file content (just in a different folder).
|
|
61
|
+
// So the request definition itself should be correct.
|
|
62
|
+
// Let's try sending it as JSON first (n8n default for object body).
|
|
63
|
+
|
|
64
|
+
const req = https.request(options, (res) => {
|
|
65
|
+
let data = '';
|
|
66
|
+
res.on('data', (chunk) => {
|
|
67
|
+
data += chunk;
|
|
68
|
+
});
|
|
69
|
+
res.on('end', () => {
|
|
70
|
+
console.log(`Status Code: ${res.statusCode}`);
|
|
71
|
+
console.log(`Body: ${data}`);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
req.on('error', (error) => {
|
|
76
|
+
console.error(error);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// If n8n sends as JSON:
|
|
80
|
+
// req.setHeader('Content-Type', 'application/json');
|
|
81
|
+
// req.write(requestBody);
|
|
82
|
+
|
|
83
|
+
// Wait, CiviCrm v4 API usually expects `params` parameter if using form-urlencoded, OR direct JSON?
|
|
84
|
+
// Let's look at `GenericFunctions.ts` again.
|
|
85
|
+
// It wraps the body in `params: JSON.stringify(body)`.
|
|
86
|
+
// The `test` request DOES NOT do that. It just sends `body: { version: 4 ... }`.
|
|
87
|
+
// Does n8n credential tester use the `authenticate` block? Yes.
|
|
88
|
+
// Does it use `GenericFunctions`? No.
|
|
89
|
+
// So if the `test` request works in the old version, then CiviCRM API4 MUST accept raw JSON body on that endpoint.
|
|
90
|
+
// Let's try sending standard JSON.
|
|
91
|
+
|
|
92
|
+
req.setHeader('Content-Type', 'application/json');
|
|
93
|
+
req.write(requestBody);
|
|
94
|
+
req.end();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CiviCrmApi = void 0;
|
|
3
|
+
exports.civiCrmApi = exports.CiviCrmApi = void 0;
|
|
4
4
|
class CiviCrmApi {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.name = 'civiCrmApi';
|
|
@@ -8,16 +8,16 @@ class CiviCrmApi {
|
|
|
8
8
|
this.documentationUrl = 'https://docs.civicrm.org/dev/en/latest/api/v4/usage/#auth';
|
|
9
9
|
this.properties = [
|
|
10
10
|
{
|
|
11
|
-
displayName: 'URL',
|
|
12
|
-
name: '
|
|
11
|
+
displayName: 'Base URL',
|
|
12
|
+
name: 'baseUrl',
|
|
13
13
|
type: 'string',
|
|
14
14
|
default: '',
|
|
15
15
|
placeholder: 'https://example.org/civicrm',
|
|
16
16
|
required: true,
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
displayName: 'API
|
|
20
|
-
name: '
|
|
19
|
+
displayName: 'API Token',
|
|
20
|
+
name: 'apiToken',
|
|
21
21
|
type: 'string',
|
|
22
22
|
typeOptions: {
|
|
23
23
|
password: true,
|
|
@@ -30,14 +30,13 @@ class CiviCrmApi {
|
|
|
30
30
|
type: 'generic',
|
|
31
31
|
properties: {
|
|
32
32
|
headers: {
|
|
33
|
-
|
|
33
|
+
'X-Civi-Auth': '={{ "Bearer " + $credentials.apiToken }}',
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
this.test = {
|
|
38
38
|
request: {
|
|
39
|
-
|
|
40
|
-
url: '/civicrm/ajax/api4/Contact/get',
|
|
39
|
+
url: '={{ $credentials.baseUrl }}/civicrm/ajax/api4/Contact/get',
|
|
41
40
|
method: 'POST',
|
|
42
41
|
body: {
|
|
43
42
|
version: 4,
|
|
@@ -50,3 +49,4 @@ class CiviCrmApi {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
exports.CiviCrmApi = CiviCrmApi;
|
|
52
|
+
exports.civiCrmApi = CiviCrmApi;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.credentials = exports.nodes = void 0;
|
|
7
7
|
const CiviCrm_node_1 = __importDefault(require("./nodes/CiviCrm/CiviCrm.node"));
|
|
8
|
-
const CiviCrmApi_credentials_1 = require("
|
|
8
|
+
const CiviCrmApi_credentials_1 = require("../credentials/CiviCrmApi.credentials");
|
|
9
9
|
exports.nodes = [
|
|
10
10
|
new CiviCrm_node_1.default(),
|
|
11
11
|
];
|
|
@@ -61,6 +61,32 @@ class CiviCrm {
|
|
|
61
61
|
defaults: { name: 'CiviCRM' },
|
|
62
62
|
inputs: ['main'],
|
|
63
63
|
outputs: ['main'],
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
usableAsTool: true,
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
actions: [
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Get Contact',
|
|
70
|
+
name: 'getContact',
|
|
71
|
+
action: 'Get a contact',
|
|
72
|
+
description: 'Retrieve a contact from CiviCRM by ID or email.',
|
|
73
|
+
displayOptions: {
|
|
74
|
+
show: {
|
|
75
|
+
resource: ['contact'],
|
|
76
|
+
operation: ['get'],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
properties: [
|
|
80
|
+
{
|
|
81
|
+
displayName: 'ID',
|
|
82
|
+
name: 'id',
|
|
83
|
+
type: 'number',
|
|
84
|
+
default: 0,
|
|
85
|
+
description: 'The internal CiviCRM ID of the contact to retrieve.',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
64
90
|
credentials: [{ name: 'civiCrmApi', required: true }],
|
|
65
91
|
properties: [
|
|
66
92
|
//
|
|
@@ -76,6 +102,7 @@ class CiviCrm {
|
|
|
76
102
|
name: 'contactType',
|
|
77
103
|
type: 'options',
|
|
78
104
|
default: 'Individual',
|
|
105
|
+
description: 'Type of contact to create or search for.',
|
|
79
106
|
options: [
|
|
80
107
|
{ name: 'Individual', value: 'Individual' },
|
|
81
108
|
{ name: 'Organization', value: 'Organization' },
|
|
@@ -91,6 +118,7 @@ class CiviCrm {
|
|
|
91
118
|
name: 'emailLocation',
|
|
92
119
|
type: 'options',
|
|
93
120
|
default: 'Work',
|
|
121
|
+
description: 'Location type for the email address.',
|
|
94
122
|
options: [
|
|
95
123
|
{ name: 'Home', value: 'Home' },
|
|
96
124
|
{ name: 'Work', value: 'Work' },
|
|
@@ -103,6 +131,7 @@ class CiviCrm {
|
|
|
103
131
|
name: 'phoneLocation',
|
|
104
132
|
type: 'options',
|
|
105
133
|
default: 'Work',
|
|
134
|
+
description: 'Location type for the phone number.',
|
|
106
135
|
options: [
|
|
107
136
|
{ name: 'Home', value: 'Home' },
|
|
108
137
|
{ name: 'Work', value: 'Work' },
|
|
@@ -116,6 +145,7 @@ class CiviCrm {
|
|
|
116
145
|
name: 'addressLocation',
|
|
117
146
|
type: 'options',
|
|
118
147
|
default: 'Home',
|
|
148
|
+
description: 'Location type for the address.',
|
|
119
149
|
options: [
|
|
120
150
|
{ name: 'Home', value: 'Home' },
|
|
121
151
|
{ name: 'Work', value: 'Work' },
|
|
@@ -132,6 +162,7 @@ class CiviCrm {
|
|
|
132
162
|
name: 'isPrimary',
|
|
133
163
|
type: 'boolean',
|
|
134
164
|
default: true,
|
|
165
|
+
description: 'Whether this should be the primary email/phone/address for the contact.',
|
|
135
166
|
displayOptions: { show: { resource: ['contact'], operation: ['create', 'update'] } },
|
|
136
167
|
},
|
|
137
168
|
//
|
|
@@ -143,6 +174,7 @@ class CiviCrm {
|
|
|
143
174
|
type: 'number',
|
|
144
175
|
default: 0,
|
|
145
176
|
required: true,
|
|
177
|
+
description: 'The internal CiviCRM ID of the entity.',
|
|
146
178
|
displayOptions: {
|
|
147
179
|
show: {
|
|
148
180
|
operation: ['get', 'update', 'delete'],
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.upsertFields = exports.genericFields = void 0;
|
|
4
|
+
exports.genericFields = [
|
|
5
|
+
{ displayName: 'Return All', name: 'returnAll', type: 'boolean', default: false, description: 'Whether to return all results or only up to a given limit.', displayOptions: { show: { operation: ['getMany'] } } },
|
|
6
|
+
{ displayName: 'Limit', name: 'limit', type: 'number', typeOptions: { minValue: 1, maxValue: 1000 }, default: 100, description: 'Max number of results to return.', displayOptions: { show: { operation: ['getMany'], returnAll: [false] } } },
|
|
7
|
+
{ displayName: 'Where (JSON)', name: 'whereJson', type: 'string', default: '', placeholder: `[["first_name","=","Alice"]]`, description: 'JSON array of arrays for filtering. Example: [["first_name","=","Alice"], ["contact_type","=","Individual"]]', displayOptions: { show: { operation: ['getMany'] } } },
|
|
8
|
+
];
|
|
9
|
+
exports.upsertFields = [
|
|
10
|
+
{ displayName: 'Fields', name: 'fields', type: 'fixedCollection', typeOptions: { multipleValues: true }, default: {}, description: 'Fields to set for the entity.', options: [{ name: 'field', displayName: 'Field', values: [{ displayName: 'Name', name: 'fieldName', type: 'string', default: '', description: 'Name of the field (e.g. first_name).' }, { displayName: 'Value', name: 'fieldValue', type: 'string', default: '', description: 'Value to set.' }] }], displayOptions: { show: { operation: ['create', 'update'] } } }
|
|
11
|
+
];
|
|
@@ -11,6 +11,7 @@ exports.resourceProp = {
|
|
|
11
11
|
name: 'resource',
|
|
12
12
|
type: 'options',
|
|
13
13
|
default: 'contact',
|
|
14
|
+
description: 'The entity to operate on. Choose "Custom API Call" to access any CiviCRM APIv4 entity not listed.',
|
|
14
15
|
options: [
|
|
15
16
|
{ name: 'Contact', value: 'contact' },
|
|
16
17
|
{ name: 'Membership', value: 'membership' },
|
|
@@ -31,6 +32,7 @@ exports.operationProp = {
|
|
|
31
32
|
type: 'options',
|
|
32
33
|
default: 'getMany',
|
|
33
34
|
noDataExpression: true,
|
|
35
|
+
description: 'The action to perform on the selected resource.',
|
|
34
36
|
options: [
|
|
35
37
|
{ name: 'Create', value: 'create' },
|
|
36
38
|
{ name: 'Delete', value: 'delete' },
|
|
@@ -10,7 +10,7 @@ const n8n_workflow_1 = require("n8n-workflow");
|
|
|
10
10
|
async function civicrmApiRequest(method, path, body) {
|
|
11
11
|
var _a;
|
|
12
12
|
const credentials = await this.getCredentials('civiCrmApi');
|
|
13
|
-
const baseUrl = credentials.
|
|
13
|
+
const baseUrl = credentials.baseUrl.replace(/\/$/, '');
|
|
14
14
|
const options = {
|
|
15
15
|
method,
|
|
16
16
|
url: `${baseUrl}${path}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixiam/n8n-nodes-civicrm",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"description": "Full-featured CiviCRM API v4 integration for n8n with support for Contacts, Memberships, Groups, Relationships, Activities and structured sub-entities like Email, Phone, and Address.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"dev": "n8n-node dev",
|
|
17
17
|
"build": "n8n-node build && pnpm run copy:assets",
|
|
18
|
-
"copy:assets": "cp nodes/CiviCrm/civicrm.svg dist/nodes/CiviCrm/",
|
|
18
|
+
"copy:assets": "cp src/nodes/CiviCrm/civicrm.svg dist/src/nodes/CiviCrm/",
|
|
19
19
|
"lint": "n8n-node lint",
|
|
20
20
|
"release": "n8n-node release",
|
|
21
21
|
"test": "npm run build"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"n8nNodesApiVersion": 1,
|
|
37
37
|
"strict": true,
|
|
38
38
|
"nodes": [
|
|
39
|
-
"dist/nodes/CiviCrm/CiviCrm.node.js"
|
|
39
|
+
"dist/src/nodes/CiviCrm/CiviCrm.node.js"
|
|
40
40
|
],
|
|
41
41
|
"credentials": [
|
|
42
42
|
"dist/credentials/CiviCrmApi.credentials.js"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { INodeType, ICredentialType } from 'n8n-workflow';
|
|
2
2
|
|
|
3
3
|
import CiviCrmNode from './nodes/CiviCrm/CiviCrm.node';
|
|
4
|
-
import { CiviCrmApi } from '
|
|
4
|
+
import { CiviCrmApi } from '../credentials/CiviCrmApi.credentials';
|
|
5
5
|
|
|
6
6
|
export const nodes: INodeType[] = [
|
|
7
7
|
new CiviCrmNode(),
|
|
@@ -90,6 +90,33 @@ export class CiviCrm implements INodeType {
|
|
|
90
90
|
defaults: { name: 'CiviCRM' },
|
|
91
91
|
inputs: ['main'],
|
|
92
92
|
outputs: ['main'],
|
|
93
|
+
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
usableAsTool: true,
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
actions: [
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Get Contact',
|
|
100
|
+
name: 'getContact',
|
|
101
|
+
action: 'Get a contact',
|
|
102
|
+
description: 'Retrieve a contact from CiviCRM by ID or email.',
|
|
103
|
+
displayOptions: {
|
|
104
|
+
show: {
|
|
105
|
+
resource: ['contact'],
|
|
106
|
+
operation: ['get'],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
properties: [
|
|
110
|
+
{
|
|
111
|
+
displayName: 'ID',
|
|
112
|
+
name: 'id',
|
|
113
|
+
type: 'number',
|
|
114
|
+
default: 0,
|
|
115
|
+
description: 'The internal CiviCRM ID of the contact to retrieve.',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
93
120
|
credentials: [{ name: 'civiCrmApi', required: true }],
|
|
94
121
|
|
|
95
122
|
properties: [
|
|
@@ -107,6 +134,7 @@ export class CiviCrm implements INodeType {
|
|
|
107
134
|
name: 'contactType',
|
|
108
135
|
type: 'options',
|
|
109
136
|
default: 'Individual',
|
|
137
|
+
description: 'Type of contact to create or search for.',
|
|
110
138
|
options: [
|
|
111
139
|
{ name: 'Individual', value: 'Individual' },
|
|
112
140
|
{ name: 'Organization', value: 'Organization' },
|
|
@@ -123,6 +151,7 @@ export class CiviCrm implements INodeType {
|
|
|
123
151
|
name: 'emailLocation',
|
|
124
152
|
type: 'options',
|
|
125
153
|
default: 'Work',
|
|
154
|
+
description: 'Location type for the email address.',
|
|
126
155
|
options: [
|
|
127
156
|
{ name: 'Home', value: 'Home' },
|
|
128
157
|
{ name: 'Work', value: 'Work' },
|
|
@@ -135,6 +164,7 @@ export class CiviCrm implements INodeType {
|
|
|
135
164
|
name: 'phoneLocation',
|
|
136
165
|
type: 'options',
|
|
137
166
|
default: 'Work',
|
|
167
|
+
description: 'Location type for the phone number.',
|
|
138
168
|
options: [
|
|
139
169
|
{ name: 'Home', value: 'Home' },
|
|
140
170
|
{ name: 'Work', value: 'Work' },
|
|
@@ -148,6 +178,7 @@ export class CiviCrm implements INodeType {
|
|
|
148
178
|
name: 'addressLocation',
|
|
149
179
|
type: 'options',
|
|
150
180
|
default: 'Home',
|
|
181
|
+
description: 'Location type for the address.',
|
|
151
182
|
options: [
|
|
152
183
|
{ name: 'Home', value: 'Home' },
|
|
153
184
|
{ name: 'Work', value: 'Work' },
|
|
@@ -165,6 +196,7 @@ export class CiviCrm implements INodeType {
|
|
|
165
196
|
name: 'isPrimary',
|
|
166
197
|
type: 'boolean',
|
|
167
198
|
default: true,
|
|
199
|
+
description: 'Whether this should be the primary email/phone/address for the contact.',
|
|
168
200
|
displayOptions: { show: { resource: ['contact'], operation: ['create', 'update'] } },
|
|
169
201
|
},
|
|
170
202
|
|
|
@@ -177,6 +209,7 @@ export class CiviCrm implements INodeType {
|
|
|
177
209
|
type: 'number',
|
|
178
210
|
default: 0,
|
|
179
211
|
required: true,
|
|
212
|
+
description: 'The internal CiviCRM ID of the entity.',
|
|
180
213
|
displayOptions: {
|
|
181
214
|
show: {
|
|
182
215
|
operation: ['get', 'update', 'delete'],
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export const genericFields: INodeProperties[] = [
|
|
3
|
+
{ displayName: 'Return All', name: 'returnAll', type: 'boolean', default: false, description: 'Whether to return all results or only up to a given limit.', displayOptions: { show: { operation: ['getMany'] } } },
|
|
4
|
+
{ displayName: 'Limit', name: 'limit', type: 'number', typeOptions: { minValue: 1, maxValue: 1000 }, default: 100, description: 'Max number of results to return.', displayOptions: { show: { operation: ['getMany'], returnAll: [false] } } },
|
|
5
|
+
{ displayName: 'Where (JSON)', name: 'whereJson', type: 'string', default: '', placeholder: `[["first_name","=","Alice"]]`, description: 'JSON array of arrays for filtering. Example: [["first_name","=","Alice"], ["contact_type","=","Individual"]]', displayOptions: { show: { operation: ['getMany'] } } },
|
|
6
|
+
];
|
|
7
|
+
export const upsertFields: INodeProperties[] = [
|
|
8
|
+
{ displayName: 'Fields', name: 'fields', type: 'fixedCollection', typeOptions: { multipleValues: true }, default: {}, description: 'Fields to set for the entity.', options: [{ name: 'field', displayName: 'Field', values: [{ displayName: 'Name', name: 'fieldName', type: 'string', default: '', description: 'Name of the field (e.g. first_name).' }, { displayName: 'Value', name: 'fieldValue', type: 'string', default: '', description: 'Value to set.' }] }], displayOptions: { show: { operation: ['create', 'update'] } } }
|
|
9
|
+
];
|
|
@@ -10,6 +10,7 @@ export const resourceProp: INodeProperties = {
|
|
|
10
10
|
name: 'resource',
|
|
11
11
|
type: 'options',
|
|
12
12
|
default: 'contact',
|
|
13
|
+
description: 'The entity to operate on. Choose "Custom API Call" to access any CiviCRM APIv4 entity not listed.',
|
|
13
14
|
options: [
|
|
14
15
|
{ name: 'Contact', value: 'contact' },
|
|
15
16
|
{ name: 'Membership', value: 'membership' },
|
|
@@ -31,6 +32,7 @@ export const operationProp: INodeProperties = {
|
|
|
31
32
|
type: 'options',
|
|
32
33
|
default: 'getMany',
|
|
33
34
|
noDataExpression: true,
|
|
35
|
+
description: 'The action to perform on the selected resource.',
|
|
34
36
|
options: [
|
|
35
37
|
{ name: 'Create', value: 'create' },
|
|
36
38
|
{ name: 'Delete', value: 'delete' },
|
|
@@ -12,7 +12,7 @@ export async function civicrmApiRequest(
|
|
|
12
12
|
body: Record<string, unknown>,
|
|
13
13
|
) {
|
|
14
14
|
const credentials = await this.getCredentials('civiCrmApi');
|
|
15
|
-
const baseUrl = (credentials.
|
|
15
|
+
const baseUrl = (credentials.baseUrl as string).replace(/\/$/, '');
|
|
16
16
|
|
|
17
17
|
const options: IHttpRequestOptions = {
|
|
18
18
|
method,
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.upsertFields = exports.genericFields = void 0;
|
|
4
|
-
exports.genericFields = [
|
|
5
|
-
{ displayName: 'Return All', name: 'returnAll', type: 'boolean', default: false, displayOptions: { show: { operation: ['getMany'] } } },
|
|
6
|
-
{ displayName: 'Limit', name: 'limit', type: 'number', typeOptions: { minValue: 1, maxValue: 1000 }, default: 100, displayOptions: { show: { operation: ['getMany'], returnAll: [false] } } },
|
|
7
|
-
{ displayName: 'Where (JSON)', name: 'whereJson', type: 'string', default: '', placeholder: `[["first_name","=","Alice"]]`, displayOptions: { show: { operation: ['getMany'] } } },
|
|
8
|
-
];
|
|
9
|
-
exports.upsertFields = [
|
|
10
|
-
{ displayName: 'Fields', name: 'fields', type: 'fixedCollection', typeOptions: { multipleValues: true }, default: {}, options: [{ name: 'field', displayName: 'Field', values: [{ displayName: 'Name', name: 'fieldName', type: 'string', default: '' }, { displayName: 'Value', name: 'fieldValue', type: 'string', default: '' }] }], displayOptions: { show: { operation: ['create', 'update'] } } }
|
|
11
|
-
];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
-
export const genericFields: INodeProperties[] = [
|
|
3
|
-
{ displayName: 'Return All', name: 'returnAll', type: 'boolean', default: false, displayOptions: { show: { operation: ['getMany'] } } },
|
|
4
|
-
{ displayName: 'Limit', name: 'limit', type: 'number', typeOptions: { minValue: 1, maxValue: 1000 }, default: 100, displayOptions: { show: { operation: ['getMany'], returnAll: [false] } } },
|
|
5
|
-
{ displayName: 'Where (JSON)', name: 'whereJson', type: 'string', default: '', placeholder: `[["first_name","=","Alice"]]`, displayOptions: { show: { operation: ['getMany'] } } },
|
|
6
|
-
];
|
|
7
|
-
export const upsertFields: INodeProperties[] = [
|
|
8
|
-
{ displayName: 'Fields', name: 'fields', type: 'fixedCollection', typeOptions: { multipleValues: true }, default: {}, options: [{ name:'field', displayName:'Field', values:[{displayName:'Name',name:'fieldName',type:'string',default:''},{displayName:'Value',name:'fieldValue',type:'string',default:''}]}], displayOptions: { show: { operation: ['create','update'] } } }
|
|
9
|
-
];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright 2022 n8n
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
-
the Software without restriction, including without limitation the rights to
|
|
6
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
-
so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
SOFTWARE.
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# n8n-nodes-civigo
|
|
2
|
-
|
|
3
|
-
This is an n8n community node. It lets you use CiviCRM in your n8n workflows.
|
|
4
|
-
|
|
5
|
-
[n8n](https://n8n.io/) is a fair-code licensed workflow automation platform.
|
|
6
|
-
|
|
7
|
-
[Installation](#installation)
|
|
8
|
-
[Operations](#operations)
|
|
9
|
-
[Credentials](#credentials)
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
Follow the [installation guide](https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally/) in the n8n documentation.
|
|
14
|
-
|
|
15
|
-
## Operations
|
|
16
|
-
|
|
17
|
-
### Contact
|
|
18
|
-
* Create
|
|
19
|
-
* Get
|
|
20
|
-
* Get Many
|
|
21
|
-
* Update
|
|
22
|
-
|
|
23
|
-
### Generic
|
|
24
|
-
* Perform any CiviCRM API v4 action by specifying Entity, Action and Parameters.
|
|
25
|
-
|
|
26
|
-
## Credentials
|
|
27
|
-
|
|
28
|
-
### CiviCRM API
|
|
29
|
-
* **URL**: The base URL of your CiviCRM instance (e.g. `https://example.org`).
|
|
30
|
-
* **Site Key**: Defined in `civicrm.settings.php`.
|
|
31
|
-
* **API Key**: The API key of the user.
|
|
32
|
-
|
|
33
|
-
## Compatibility
|
|
34
|
-
tested with n8n v0.200+ and CiviCRM 5.x.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "n8n-nodes-civigo",
|
|
3
|
-
"version": "0.1.3",
|
|
4
|
-
"description": "n8n node for CiviCRM (Civigo)",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"homepage": "",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"n8n-community-node-package"
|
|
9
|
-
],
|
|
10
|
-
"author": {
|
|
11
|
-
"name": "ixiam global solutions",
|
|
12
|
-
"email": "j.reartes@ixiam.com"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/soyjulen/n8n-nodes-civigo.git"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "n8n-node build",
|
|
20
|
-
"build:watch": "tsc --watch",
|
|
21
|
-
"dev": "n8n-node dev",
|
|
22
|
-
"lint": "n8n-node lint",
|
|
23
|
-
"lint:fix": "n8n-node lint --fix",
|
|
24
|
-
"release": "n8n-node release",
|
|
25
|
-
"prepublishOnly": "n8n-node prerelease"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist"
|
|
29
|
-
],
|
|
30
|
-
"n8n": {
|
|
31
|
-
"n8nNodesApiVersion": 1,
|
|
32
|
-
"strict": true,
|
|
33
|
-
"credentials": [
|
|
34
|
-
"dist/credentials/CiviCrmApi.credentials.js"
|
|
35
|
-
],
|
|
36
|
-
"nodes": [
|
|
37
|
-
"dist/nodes/CiviCrm/CiviCrm.node.js"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@n8n/node-cli": "^0.17.0",
|
|
42
|
-
"@types/node": "^25.0.3",
|
|
43
|
-
"@types/request": "^2.48.13",
|
|
44
|
-
"eslint": "9.32.0",
|
|
45
|
-
"prettier": "3.6.2",
|
|
46
|
-
"release-it": "^19.0.4",
|
|
47
|
-
"typescript": "5.9.2"
|
|
48
|
-
},
|
|
49
|
-
"peerDependencies": {
|
|
50
|
-
"n8n-workflow": "*"
|
|
51
|
-
},
|
|
52
|
-
"overrides": {
|
|
53
|
-
"change-case": "4.1.2",
|
|
54
|
-
"ora": "5.4.1",
|
|
55
|
-
"string-width": "4.2.3",
|
|
56
|
-
"wrap-ansi": "7.0.0",
|
|
57
|
-
"strip-ansi": "6.0.1"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
File without changes
|
|
File without changes
|