@ixiam/n8n-nodes-civicrm 1.1.0 β 1.1.19
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/LICENSE +21 -0
- package/README.md +106 -8
- package/credentials/CiviCrmApi.credentials.ts +58 -0
- package/dist/credentials/CiviCrmApi.credentials.d.ts +30 -0
- package/dist/credentials/CiviCrmApi.credentials.js +27 -20
- package/dist/nodes/CiviCrm/CiviCrm.node.d.ts +14 -0
- package/dist/nodes/CiviCrm/CiviCrm.node.js +8 -9
- package/dist/nodes/CiviCrm/civicrm.svg +28 -0
- package/dist/nodes/CiviCrm/descriptions/generic.d.ts +3 -0
- package/dist/nodes/CiviCrm/descriptions/resources.d.ts +3 -0
- package/dist/nodes/transport/GenericFunctions.d.ts +10 -0
- package/dist/nodes/transport/GenericFunctions.js +1 -2
- package/nodes/CiviCrm/CiviCrm.node.ts +664 -0
- package/nodes/CiviCrm/civicrm.svg +28 -0
- package/nodes/CiviCrm/descriptions/generic.ts +9 -0
- package/nodes/CiviCrm/descriptions/resources.ts +41 -0
- package/nodes/transport/GenericFunctions.ts +51 -0
- package/package.json +71 -7
- package/src/credentials/CiviCrmApi.credentials.ts +6 -6
- package/src/credentials/CiviCrmApi.credentials.ts.bak +52 -0
- package/sxkeychain erase +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 iXiam Global Solutions
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
# n8n-nodes-civicrm
|
|
2
|
+
<<<<<<< HEAD
|
|
2
3
|
|
|
3
4
|

|
|
4
5
|

|
|
5
6
|

|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
Community Node for **CiviCRM API v4** (Civi-Go compatible)
|
|
8
|
+
Community Node for **CiviCRM API v4** (Civi-Go compatible)
|
|
9
9
|
Developed and maintained by **Ixiam Global Solutions**.
|
|
10
10
|
|
|
11
|
-
This package provides integration between **n8n** and **CiviCRM API v4**, supporting create, update, delete operations, advanced filtering, dynamic location types, and structured sub-entities (email, phone, address).
|
|
11
|
+
This package provides integration between **n8n** and **CiviCRM API v4**, supporting create, update, delete operations, advanced filtering, dynamic location types, and structured sub-entities (email, phone, address).
|
|
12
12
|
Custom fields are **not** supported.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<img src="https://civicrm.org/sites/civicrm.org/files/CiviCRM-logo-2019-F2-200px.png" alt="CiviCRM Logo" width="260" />
|
|
17
|
-
</p>
|
|
14
|
+
---
|
|
15
|
+
# About CiviCRM
|
|
18
16
|
|
|
19
17
|
CiviCRM is an open-source Constituent Relationship Management platform designed for nonprofits, NGOs, and advocacy organizations. It supports contact management, memberships, contributions, event registration, email marketing, case management, and reporting. CiviCRM integrates with WordPress, Drupal, and Joomla.
|
|
20
18
|
|
|
21
19
|
Download: https://civicrm.org/download
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
|
|
24
22
|
## Installation
|
|
25
23
|
|
|
26
24
|
1. In your n8n instance, open:
|
|
25
|
+
=======
|
|
26
|
+
Community Node for **CiviCRM API v4** (Civi-Go compatible)
|
|
27
|
+
Developed and maintained by **Ixiam Global Solutions**.
|
|
28
|
+
|
|
29
|
+
This node enables full integration between **n8n** and **CiviCRM API v4**, supporting create/update/delete operations, smart field mapping, dynamic location types, and advanced filtering on GET operations.
|
|
30
|
+
|
|
31
|
+
## π Installation
|
|
32
|
+
|
|
33
|
+
1. In your n8n instance, go to:
|
|
34
|
+
>>>>>>> 03f29e40d265531031a602d4bdcf4724e39bd809
|
|
27
35
|
**Settings β Community Nodes β Install**
|
|
28
36
|
2. Enter the package name:
|
|
29
37
|
|
|
30
38
|
```
|
|
39
|
+
<<<<<<< HEAD
|
|
31
40
|
@ixiam/n8n-nodes-civicrm
|
|
32
41
|
```
|
|
33
42
|
|
|
@@ -88,6 +97,81 @@ home.phone.phone_type_id = 2
|
|
|
88
97
|
### GET MANY with JSON filters
|
|
89
98
|
Example:
|
|
90
99
|
```json
|
|
100
|
+
=======
|
|
101
|
+
n8n-nodes-civicrm
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
3. Approve installation and enable Community Nodes.
|
|
105
|
+
|
|
106
|
+
## π Credentials
|
|
107
|
+
|
|
108
|
+
The node uses **Bearer Token Authentication**.
|
|
109
|
+
|
|
110
|
+
| Field | Description |
|
|
111
|
+
|-------|-------------|
|
|
112
|
+
| **Base URL** | The root URL of your CiviCRM instance (without trailing slash). Example: `https://crm.example.org` |
|
|
113
|
+
| **API Token** | Sent as header `X-Civi-Auth: Bearer <token>` |
|
|
114
|
+
|
|
115
|
+
After entering credentials, click **Save** to validate the connection.
|
|
116
|
+
|
|
117
|
+
## π¦ Supported Entities
|
|
118
|
+
|
|
119
|
+
The node includes full API v4 support for the following entities:
|
|
120
|
+
|
|
121
|
+
| Entity | Operations |
|
|
122
|
+
|--------|------------|
|
|
123
|
+
| **Contact** | get, getMany, create, update, delete |
|
|
124
|
+
| **Membership** | get, getMany, create, update, delete |
|
|
125
|
+
| **Group** | get, getMany, create, update, delete |
|
|
126
|
+
| **Relationship** | get, getMany, create, update, delete |
|
|
127
|
+
| **Activity** | get, getMany, create, update, delete |
|
|
128
|
+
| **Custom API Call** | full custom API4 request |
|
|
129
|
+
|
|
130
|
+
## π§© Key Features
|
|
131
|
+
|
|
132
|
+
### **1. Dynamic Field Mapping**
|
|
133
|
+
Supports any standard or custom field:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
first_name = John
|
|
137
|
+
last_name = Doe
|
|
138
|
+
custom_45 = Blue
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### **2. Smart Email, Phone & Address Mapping**
|
|
142
|
+
Two ways to set location-aware fields:
|
|
143
|
+
|
|
144
|
+
**(A) Simple fields**
|
|
145
|
+
```
|
|
146
|
+
email = test@example.org
|
|
147
|
+
phone.mobile = 600123456
|
|
148
|
+
address.city = Barcelona
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**(B) Dynamic prefixes matched to CiviCRM Location Types**
|
|
152
|
+
```
|
|
153
|
+
work.email = user@company.org
|
|
154
|
+
billing.address.postal_code = 80331
|
|
155
|
+
home.phone.phone_type_id = 2
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### **3. Default Location Type selectors**
|
|
159
|
+
If no prefix is used, default types are applied.
|
|
160
|
+
|
|
161
|
+
### **4. Birth Date Normalization**
|
|
162
|
+
Accepted input formats:
|
|
163
|
+
|
|
164
|
+
- YYYY-MM-DD
|
|
165
|
+
- DD/MM/YYYY
|
|
166
|
+
- DD-MM-YYYY
|
|
167
|
+
- YYYY/MM/DD
|
|
168
|
+
- YYYY.MM.DD
|
|
169
|
+
|
|
170
|
+
Auto-normalized to `YYYY-MM-DD`.
|
|
171
|
+
|
|
172
|
+
### **5. GET MANY with JSON Filters**
|
|
173
|
+
```
|
|
174
|
+
>>>>>>> 03f29e40d265531031a602d4bdcf4724e39bd809
|
|
91
175
|
[
|
|
92
176
|
["first_name", "LIKE", "Ju%"],
|
|
93
177
|
["birth_date", ">", "1990-01-01"],
|
|
@@ -95,6 +179,7 @@ Example:
|
|
|
95
179
|
]
|
|
96
180
|
```
|
|
97
181
|
|
|
182
|
+
<<<<<<< HEAD
|
|
98
183
|
### Birth date normalization
|
|
99
184
|
Accepted input formats:
|
|
100
185
|
- YYYY-MM-DD
|
|
@@ -108,6 +193,10 @@ Normalized to `YYYY-MM-DD`.
|
|
|
108
193
|
### Custom API Call
|
|
109
194
|
Example:
|
|
110
195
|
```json
|
|
196
|
+
=======
|
|
197
|
+
### **6. Custom API Call Mode**
|
|
198
|
+
```
|
|
199
|
+
>>>>>>> 03f29e40d265531031a602d4bdcf4724e39bd809
|
|
111
200
|
{
|
|
112
201
|
"entity": "Contact",
|
|
113
202
|
"action": "get",
|
|
@@ -115,6 +204,7 @@ Example:
|
|
|
115
204
|
}
|
|
116
205
|
```
|
|
117
206
|
|
|
207
|
+
<<<<<<< HEAD
|
|
118
208
|
---
|
|
119
209
|
|
|
120
210
|
## Compatibility
|
|
@@ -155,5 +245,13 @@ Email: info@ixiam.com
|
|
|
155
245
|
---
|
|
156
246
|
|
|
157
247
|
## License
|
|
248
|
+
=======
|
|
249
|
+
## π§βπ» About Ixiam Global Solutions
|
|
250
|
+
|
|
251
|
+
Website: **https://www.ixiam.com**
|
|
252
|
+
Contact: **info@ixiam.com**
|
|
253
|
+
|
|
254
|
+
## π License
|
|
255
|
+
>>>>>>> 03f29e40d265531031a602d4bdcf4724e39bd809
|
|
158
256
|
|
|
159
257
|
MIT License
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ICredentialType,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
IHttpRequestMethods,
|
|
5
|
+
} from 'n8n-workflow';
|
|
6
|
+
|
|
7
|
+
export class CiviCrmApi implements ICredentialType {
|
|
8
|
+
name = 'civiCrmApi';
|
|
9
|
+
displayName = 'CiviCRM API';
|
|
10
|
+
documentationUrl = 'https://docs.civicrm.org/dev/en/latest/api/';
|
|
11
|
+
|
|
12
|
+
authenticate = {
|
|
13
|
+
type: 'generic' as const,
|
|
14
|
+
properties: {
|
|
15
|
+
headers: {
|
|
16
|
+
'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
|
|
17
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Credential test button
|
|
23
|
+
test = {
|
|
24
|
+
request: {
|
|
25
|
+
method: 'POST' as IHttpRequestMethods,
|
|
26
|
+
url: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/civicrm/ajax/api4/Contact/get',
|
|
27
|
+
headers: {
|
|
28
|
+
'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
|
|
29
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
30
|
+
},
|
|
31
|
+
body: {
|
|
32
|
+
params: '={"limit":1}', // API4 compatible
|
|
33
|
+
},
|
|
34
|
+
json: true,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
properties: INodeProperties[] = [
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Base URL',
|
|
41
|
+
name: 'baseUrl',
|
|
42
|
+
type: 'string',
|
|
43
|
+
default: '',
|
|
44
|
+
required: true,
|
|
45
|
+
placeholder: 'https://crm.example.org',
|
|
46
|
+
description: 'Base URL without a trailing slash.',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'API Token',
|
|
50
|
+
name: 'apiToken',
|
|
51
|
+
type: 'string',
|
|
52
|
+
typeOptions: { password: true },
|
|
53
|
+
default: '',
|
|
54
|
+
required: true,
|
|
55
|
+
description: 'Sent as "X-Civi-Auth: Bearer <token>"',
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ICredentialType, INodeProperties, IHttpRequestMethods } from 'n8n-workflow';
|
|
2
|
+
export declare class CiviCrmApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
authenticate: {
|
|
7
|
+
type: "generic";
|
|
8
|
+
properties: {
|
|
9
|
+
headers: {
|
|
10
|
+
'X-Civi-Auth': string;
|
|
11
|
+
'Content-Type': string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
test: {
|
|
16
|
+
request: {
|
|
17
|
+
method: IHttpRequestMethods;
|
|
18
|
+
url: string;
|
|
19
|
+
headers: {
|
|
20
|
+
'X-Civi-Auth': string;
|
|
21
|
+
'Content-Type': string;
|
|
22
|
+
};
|
|
23
|
+
body: {
|
|
24
|
+
params: string;
|
|
25
|
+
};
|
|
26
|
+
json: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
properties: INodeProperties[];
|
|
30
|
+
}
|
|
@@ -6,6 +6,30 @@ class CiviCrmApi {
|
|
|
6
6
|
this.name = 'civiCrmApi';
|
|
7
7
|
this.displayName = 'CiviCRM API';
|
|
8
8
|
this.documentationUrl = 'https://docs.civicrm.org/dev/en/latest/api/';
|
|
9
|
+
this.authenticate = {
|
|
10
|
+
type: 'generic',
|
|
11
|
+
properties: {
|
|
12
|
+
headers: {
|
|
13
|
+
'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
|
|
14
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
// Credential test button
|
|
19
|
+
this.test = {
|
|
20
|
+
request: {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
url: '={{$credentials.baseUrl.replace(/\\/$/, "")}}/civicrm/ajax/api4/Contact/get',
|
|
23
|
+
headers: {
|
|
24
|
+
'X-Civi-Auth': '={{"Bearer " + $credentials.apiToken}}',
|
|
25
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
26
|
+
},
|
|
27
|
+
body: {
|
|
28
|
+
params: '={"limit":1}', // API4 compatible
|
|
29
|
+
},
|
|
30
|
+
json: true,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
9
33
|
this.properties = [
|
|
10
34
|
{
|
|
11
35
|
displayName: 'Base URL',
|
|
@@ -13,6 +37,8 @@ class CiviCrmApi {
|
|
|
13
37
|
type: 'string',
|
|
14
38
|
default: '',
|
|
15
39
|
required: true,
|
|
40
|
+
placeholder: 'https://crm.example.org',
|
|
41
|
+
description: 'Base URL without a trailing slash.',
|
|
16
42
|
},
|
|
17
43
|
{
|
|
18
44
|
displayName: 'API Token',
|
|
@@ -21,28 +47,9 @@ class CiviCrmApi {
|
|
|
21
47
|
typeOptions: { password: true },
|
|
22
48
|
default: '',
|
|
23
49
|
required: true,
|
|
50
|
+
description: 'Sent as "X-Civi-Auth: Bearer <token>"',
|
|
24
51
|
},
|
|
25
52
|
];
|
|
26
|
-
// β ESTA ES LA PARTE CRΓTICA
|
|
27
|
-
this.authenticate = {
|
|
28
|
-
type: 'generic',
|
|
29
|
-
properties: {
|
|
30
|
-
headers: {
|
|
31
|
-
'X-Civi-Auth': '={{ "Bearer " + $credentials.apiToken }}',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
this.test = {
|
|
36
|
-
request: {
|
|
37
|
-
method: 'POST',
|
|
38
|
-
url: '={{ $credentials.baseUrl.replace(/\\/$/, "") }}/civicrm/ajax/api4/Contact/get',
|
|
39
|
-
headers: {
|
|
40
|
-
'X-Civi-Auth': '={{ "Bearer " + $credentials.apiToken }}',
|
|
41
|
-
'Content-Type': 'application/json',
|
|
42
|
-
},
|
|
43
|
-
body: { limit: 1 },
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
exports.CiviCrmApi = CiviCrmApi;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class CiviCrm implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
loadOptionValues(this: ILoadOptionsFunctions): Promise<{
|
|
7
|
+
name: string;
|
|
8
|
+
value: number;
|
|
9
|
+
}[]>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
13
|
+
}
|
|
14
|
+
export default CiviCrm;
|
|
@@ -29,7 +29,7 @@ async function getLocationTypeMap() {
|
|
|
29
29
|
limit: 0,
|
|
30
30
|
});
|
|
31
31
|
const map = {};
|
|
32
|
-
const values = (
|
|
32
|
+
const values = (res?.values || []);
|
|
33
33
|
for (const v of values) {
|
|
34
34
|
const name = v.name || '';
|
|
35
35
|
const label = v.label || '';
|
|
@@ -169,7 +169,7 @@ class CiviCrm {
|
|
|
169
169
|
body: { params: JSON.stringify({ limit: 50, select: ['id', 'label'] }) },
|
|
170
170
|
json: true,
|
|
171
171
|
});
|
|
172
|
-
const values = (
|
|
172
|
+
const values = (res?.values || []);
|
|
173
173
|
return values.map((v) => ({
|
|
174
174
|
name: v.label,
|
|
175
175
|
value: v.id,
|
|
@@ -182,7 +182,6 @@ class CiviCrm {
|
|
|
182
182
|
EXECUTE
|
|
183
183
|
============================================================================ */
|
|
184
184
|
async execute() {
|
|
185
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
186
185
|
const items = this.getInputData();
|
|
187
186
|
const out = [];
|
|
188
187
|
const resource = this.getNodeParameter('resource', 0);
|
|
@@ -227,7 +226,7 @@ class CiviCrm {
|
|
|
227
226
|
select: ['id', 'name', 'title', 'subject', 'display_name'],
|
|
228
227
|
};
|
|
229
228
|
const res = await GenericFunctions_1.civicrmApiRequest.call(this, 'POST', `/civicrm/ajax/api4/${entity}/get`, params);
|
|
230
|
-
out.push({ json:
|
|
229
|
+
out.push({ json: res?.values?.[0] ?? {} });
|
|
231
230
|
continue;
|
|
232
231
|
}
|
|
233
232
|
/* ======================================================
|
|
@@ -279,7 +278,7 @@ class CiviCrm {
|
|
|
279
278
|
const page = 500;
|
|
280
279
|
while (true) {
|
|
281
280
|
const r = await GenericFunctions_1.civicrmApiRequest.call(this, 'POST', `/civicrm/ajax/api4/${entity}/get`, { ...params, limit: page, offset });
|
|
282
|
-
const vals =
|
|
281
|
+
const vals = r?.values ?? [];
|
|
283
282
|
for (const v of vals)
|
|
284
283
|
out.push({ json: v });
|
|
285
284
|
if (vals.length < page)
|
|
@@ -289,7 +288,7 @@ class CiviCrm {
|
|
|
289
288
|
}
|
|
290
289
|
else {
|
|
291
290
|
const r = await GenericFunctions_1.civicrmApiRequest.call(this, 'POST', `/civicrm/ajax/api4/${entity}/get`, { ...params, limit });
|
|
292
|
-
const vals =
|
|
291
|
+
const vals = r?.values ?? [];
|
|
293
292
|
for (const v of vals)
|
|
294
293
|
out.push({ json: v });
|
|
295
294
|
}
|
|
@@ -441,7 +440,7 @@ class CiviCrm {
|
|
|
441
440
|
let contactId = id;
|
|
442
441
|
if (isCreate) {
|
|
443
442
|
const r = await GenericFunctions_1.civicrmApiRequest.call(this, 'POST', '/civicrm/ajax/api4/Contact/create', { values });
|
|
444
|
-
contactId =
|
|
443
|
+
contactId = r?.values?.[0]?.id;
|
|
445
444
|
if (!contactId)
|
|
446
445
|
throw new Error('Failed to create contact.');
|
|
447
446
|
}
|
|
@@ -527,7 +526,7 @@ class CiviCrm {
|
|
|
527
526
|
}
|
|
528
527
|
: {}),
|
|
529
528
|
});
|
|
530
|
-
out.push({ json:
|
|
529
|
+
out.push({ json: res?.values?.[0] ?? {} });
|
|
531
530
|
}
|
|
532
531
|
return [out];
|
|
533
532
|
}
|
|
@@ -537,7 +536,7 @@ exports.CiviCrm = CiviCrm;
|
|
|
537
536
|
UTILS
|
|
538
537
|
============================================================================ */
|
|
539
538
|
function convertValue(val) {
|
|
540
|
-
const t = String(val
|
|
539
|
+
const t = String(val ?? '').trim();
|
|
541
540
|
if (t === '')
|
|
542
541
|
return '';
|
|
543
542
|
if (t === 'true')
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<svg xml:space="preserve" style="max-height: 500px" viewBox="190.4982463465553 39.1683 70.07818371607516 70.33139999999999" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" id="Layer_1" version="1.1" width="70.07818371607516" height="70.33139999999999">
|
|
2
|
+
<style type="text/css">
|
|
3
|
+
.st0{fill:#086287;}
|
|
4
|
+
.st1{fill:#81C459;}
|
|
5
|
+
</style>
|
|
6
|
+
<g>
|
|
7
|
+
<g>
|
|
8
|
+
<g>
|
|
9
|
+
<path d="M216.26,104.26C216.26,104.26,216.26,104.26,216.26,104.26c-3.77-0.07-5.2-4.43-5.35-4.92l-12.85-42.11
				c-0.76-2.47-0.58-4.46,0.51-5.92c0.71-0.94,2.12-2.04,4.83-1.99c0.99,0.02,1.77,0.19,1.85,0.21l42.78,9.97
				c2.75,0.64,4.44,1.94,5.02,3.85c0.93,3.04-1.65,5.92-1.95,6.24l-29.94,32.12C219.57,103.43,217.91,104.29,216.26,104.26z
				 M203.19,53.73c-0.77-0.01-1.02,0.19-1.06,0.26c-0.22,0.31-0.26,0.44,0.19,1.93l12.85,42.11c0.29,0.9,0.76,1.74,1.18,1.77l0,0
				c0.01,0,0.52,0,1.57-1.13l29.94-32.12c0.55-0.61,1.06-1.6,0.95-1.9c-0.08-0.22-0.43-0.5-1.77-0.81l-42.78-9.97l0,0
				C204.24,53.87,203.7,53.74,203.19,53.73z" class="st0"/>
|
|
10
|
+
</g>
|
|
11
|
+
<g>
|
|
12
|
+
<path d="M211.45,100.83c-1.38,0.51-2.83,0.61-3.96,0.24c0,0,0,0,0,0c-3.57-1.17-3.68-5.74-3.68-6.26l0-41l4.21,0.94
				l0.02,40.15c0.01,0.94,0.25,1.84,0.83,1.94l0,0c0,0,0.3,0.09,1.15-0.3L211.45,100.83z M214.02,94.31l34.62-20.03
				c0.7-0.42,1.53-1.04,1.46-1.54c-0.01-0.07-0.17-0.52-0.92-1.05l2.9-3.3c1.64,1.25,2.47,2.71,2.47,4.35c0,3.17-3.3,5.17-3.68,5.39
				l-35.51,20.4L214.02,94.31z M245.14,69.42l-34.02-19.79c0,0-0.85-0.54-1.34-0.7c-0.73-0.24-1.08,0-1.15,0.05
				c-0.2,0.14-0.27,0.24-0.35,1.24l-4.38-0.82c0.24-1.82,0.95-3.17,2.12-4.03c0.95-0.69,2.62-1.33,5.19-0.5
				c0.94,0.31,1.63,0.7,1.71,0.74l35.39,20.42L245.14,69.42z" class="st1"/>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
<g>
|
|
16
|
+
<path d="M183.02,66.82c-0.48-0.28-0.86-0.67-1.15-1.15c-0.28-0.48-0.42-1-0.42-1.57c0-0.56,0.14-1.09,0.42-1.57
			s0.66-0.86,1.15-1.15s1-0.42,1.57-0.42s1.09,0.14,1.57,0.42s0.86,0.66,1.15,1.15s0.42,1,0.42,1.57c0,0.57-0.14,1.09-0.42,1.57
			c-0.28,0.48-0.66,0.86-1.15,1.15s-1,0.42-1.57,0.42S183.5,67.1,183.02,66.82z M185.93,66.42c0.41-0.24,0.74-0.57,0.98-0.98
			c0.24-0.41,0.36-0.86,0.36-1.35c0-0.48-0.12-0.93-0.36-1.34c-0.24-0.41-0.57-0.73-0.98-0.98c-0.41-0.24-0.86-0.36-1.35-0.36
			c-0.48,0-0.93,0.12-1.34,0.36c-0.41,0.24-0.73,0.57-0.98,0.98c-0.24,0.41-0.36,0.85-0.36,1.34c0,0.49,0.12,0.94,0.36,1.35
			c0.24,0.41,0.57,0.74,0.98,0.98s0.85,0.36,1.34,0.36C185.07,66.79,185.52,66.66,185.93,66.42z M183.37,65.8
			c-0.06-0.05-0.08-0.12-0.08-0.21v-2.83c0-0.11,0.04-0.21,0.11-0.28s0.17-0.12,0.28-0.12h1.05c0.46,0,0.8,0.1,1.03,0.29
			s0.34,0.45,0.34,0.76c0,0.21-0.06,0.39-0.18,0.53c-0.12,0.14-0.28,0.25-0.46,0.32c0.16,0.06,0.3,0.18,0.42,0.35
			c0.12,0.18,0.18,0.42,0.18,0.74v0.24c0,0.08-0.03,0.15-0.09,0.21c-0.06,0.06-0.13,0.09-0.21,0.09s-0.15-0.03-0.21-0.09
			c-0.06-0.06-0.09-0.13-0.09-0.21v-0.16c0-0.25-0.04-0.46-0.11-0.63c-0.07-0.17-0.25-0.26-0.53-0.26h-0.95v1.06
			c0,0.08-0.03,0.15-0.09,0.21c-0.06,0.06-0.13,0.08-0.21,0.08C183.49,65.88,183.42,65.86,183.37,65.8z M184.7,64.02
			c0.25,0,0.45-0.05,0.6-0.15c0.15-0.1,0.22-0.25,0.22-0.44c0-0.18-0.06-0.32-0.19-0.42c-0.13-0.1-0.34-0.14-0.65-0.14h-0.81v1.15
			H184.7z" class="st0"/>
|
|
17
|
+
</g>
|
|
18
|
+
<g>
|
|
19
|
+
<path d="M31.72,88.55c-2.15-1.18-3.85-2.87-5.08-5.08c-1.23-2.21-1.85-4.79-1.85-7.74s0.62-5.53,1.85-7.74
			c1.23-2.21,2.93-3.9,5.08-5.08c2.15-1.18,4.58-1.77,7.29-1.77c1.84,0,3.49,0.22,4.94,0.65c1.45,0.43,2.89,1.06,4.33,1.87
			c0.6,0.32,0.89,0.84,0.89,1.54c0,0.41-0.15,0.77-0.45,1.08c-0.3,0.31-0.69,0.47-1.18,0.47c-0.27,0-0.51-0.05-0.73-0.16
			c-1.19-0.62-2.36-1.1-3.49-1.42c-1.14-0.32-2.45-0.49-3.94-0.49c-2.33,0-4.31,0.48-5.95,1.44c-1.64,0.96-2.87,2.28-3.7,3.94
			c-0.83,1.67-1.24,3.55-1.24,5.67s0.41,4,1.24,5.67c0.83,1.67,2.06,2.98,3.7,3.94c1.64,0.96,3.62,1.44,5.95,1.44
			c1.49,0,2.8-0.16,3.94-0.49c1.14-0.32,2.3-0.8,3.49-1.42c0.22-0.11,0.46-0.16,0.73-0.16c0.49,0,0.88,0.15,1.18,0.45
			c0.3,0.3,0.45,0.66,0.45,1.1c0,0.7-0.3,1.22-0.89,1.54c-1.44,0.81-2.88,1.44-4.33,1.87c-1.45,0.43-3.09,0.65-4.94,0.65
			C36.3,90.32,33.87,89.73,31.72,88.55z" class="st0"/>
|
|
20
|
+
<path d="M53.47,64.35c-0.41-0.41-0.61-0.89-0.61-1.46v-0.16c0-0.57,0.2-1.06,0.61-1.46c0.41-0.41,0.89-0.61,1.46-0.61
			h0.24c0.57,0,1.06,0.2,1.46,0.61s0.61,0.89,0.61,1.46v0.16c0,0.57-0.2,1.06-0.61,1.46c-0.41,0.41-0.89,0.61-1.46,0.61h-0.24
			C54.37,64.96,53.88,64.76,53.47,64.35z M53.72,89.58c-0.35-0.35-0.53-0.79-0.53-1.3V70.86c0-0.51,0.18-0.96,0.53-1.32
			c0.35-0.37,0.79-0.55,1.3-0.55c0.54,0,0.99,0.18,1.34,0.53c0.35,0.35,0.53,0.8,0.53,1.34v17.43c0,0.51-0.18,0.95-0.55,1.3
			c-0.37,0.35-0.81,0.53-1.32,0.53C54.5,90.11,54.07,89.94,53.72,89.58z" class="st0"/>
|
|
21
|
+
<path d="M68.5,89.69c-0.41-0.28-0.7-0.64-0.89-1.08l-7.07-16.9c-0.14-0.32-0.2-0.61-0.2-0.85
			c0-0.51,0.18-0.96,0.53-1.32c0.35-0.37,0.79-0.55,1.3-0.55c0.35,0,0.68,0.1,1,0.3c0.31,0.2,0.53,0.45,0.67,0.75l6.22,15.76
			l6.22-15.76c0.14-0.3,0.36-0.55,0.67-0.75c0.31-0.2,0.64-0.3,1-0.3c0.51,0,0.95,0.18,1.3,0.55c0.35,0.37,0.53,0.81,0.53,1.32
			c0,0.24-0.07,0.53-0.2,0.85l-7.07,16.9c-0.19,0.43-0.49,0.79-0.89,1.08s-0.85,0.43-1.34,0.43h-0.41
			C69.36,90.11,68.91,89.97,68.5,89.69z" class="st0"/>
|
|
22
|
+
<path d="M83.5,64.35c-0.41-0.41-0.61-0.89-0.61-1.46v-0.16c0-0.57,0.2-1.06,0.61-1.46c0.41-0.41,0.89-0.61,1.46-0.61
			h0.24c0.57,0,1.06,0.2,1.46,0.61s0.61,0.89,0.61,1.46v0.16c0,0.57-0.2,1.06-0.61,1.46c-0.41,0.41-0.89,0.61-1.46,0.61h-0.24
			C84.39,64.96,83.9,64.76,83.5,64.35z M83.74,89.58c-0.35-0.35-0.53-0.79-0.53-1.3V70.86c0-0.51,0.18-0.96,0.53-1.32
			c0.35-0.37,0.79-0.55,1.3-0.55c0.54,0,0.99,0.18,1.34,0.53c0.35,0.35,0.53,0.8,0.53,1.34v17.43c0,0.51-0.18,0.95-0.55,1.3
			c-0.37,0.35-0.81,0.53-1.32,0.53C84.53,90.11,84.09,89.94,83.74,89.58z" class="st0"/>
|
|
23
|
+
<path d="M97.65,88.55c-2.15-1.18-3.85-2.87-5.08-5.08c-1.23-2.21-1.85-4.79-1.85-7.74s0.62-5.53,1.85-7.74
			c1.23-2.21,2.93-3.9,5.08-5.08c2.15-1.18,4.58-1.77,7.29-1.77c1.84,0,3.49,0.22,4.94,0.65c1.45,0.43,2.89,1.06,4.33,1.87
			c0.6,0.32,0.89,0.84,0.89,1.54c0,0.41-0.15,0.77-0.45,1.08c-0.3,0.31-0.69,0.47-1.18,0.47c-0.27,0-0.51-0.05-0.73-0.16
			c-1.19-0.62-2.36-1.1-3.49-1.42c-1.14-0.32-2.45-0.49-3.94-0.49c-2.33,0-4.31,0.48-5.95,1.44c-1.64,0.96-2.87,2.28-3.7,3.94
			c-0.83,1.67-1.24,3.55-1.24,5.67s0.41,4,1.24,5.67c0.83,1.67,2.06,2.98,3.7,3.94c1.64,0.96,3.62,1.44,5.95,1.44
			c1.49,0,2.8-0.16,3.94-0.49c1.14-0.32,2.3-0.8,3.49-1.42c0.22-0.11,0.46-0.16,0.73-0.16c0.49,0,0.88,0.15,1.18,0.45
			c0.3,0.3,0.45,0.66,0.45,1.1c0,0.7-0.3,1.22-0.89,1.54c-1.44,0.81-2.88,1.44-4.33,1.87c-1.45,0.43-3.09,0.65-4.94,0.65
			C102.24,90.32,99.81,89.73,97.65,88.55z" class="st0"/>
|
|
24
|
+
<path d="M119.9,89.58c-0.35-0.35-0.53-0.79-0.53-1.3V63.42c0-0.51,0.18-0.96,0.53-1.32s0.79-0.55,1.3-0.55h9.47
			c3.68,0,6.45,0.76,8.29,2.28c1.84,1.52,2.76,3.51,2.76,5.97c0,1.62-0.45,3.11-1.36,4.45c-0.91,1.34-2.23,2.31-3.96,2.9
			c1.95,0.51,3.28,1.73,4,3.64c0.72,1.91,1.08,3.79,1.08,5.63v1.87c0,0.51-0.18,0.95-0.53,1.3c-0.35,0.35-0.79,0.53-1.3,0.53
			c-0.57,0-1.02-0.17-1.36-0.51c-0.34-0.34-0.51-0.78-0.51-1.32v-1.22c0-1.35-0.12-2.61-0.37-3.76s-0.83-2.18-1.75-3.09
			c-0.92-0.91-2.32-1.36-4.18-1.36h-8.41v9.43c0,0.51-0.18,0.95-0.55,1.3s-0.81,0.53-1.32,0.53
			C120.68,90.11,120.25,89.94,119.9,89.58z M130.42,75.37c2.33,0,4.18-0.46,5.55-1.38c1.37-0.92,2.05-2.22,2.05-3.9
			c0-1.62-0.59-2.87-1.77-3.74c-1.18-0.87-3.19-1.3-6.03-1.3h-7.15v10.32H130.42z" class="st0"/>
|
|
25
|
+
<path d="M146.71,89.58c-0.35-0.35-0.53-0.79-0.53-1.3V64.03c0-0.73,0.26-1.36,0.77-1.89
			c0.51-0.53,1.14-0.79,1.87-0.79h1.34c0.54,0,1.04,0.16,1.48,0.49c0.45,0.33,0.78,0.73,1,1.22l9.22,22.99l9.22-22.99
			c0.22-0.49,0.55-0.89,1-1.22c0.45-0.32,0.94-0.49,1.48-0.49h1.34c0.73,0,1.35,0.26,1.87,0.79c0.51,0.53,0.77,1.16,0.77,1.89v24.25
			c0,0.51-0.18,0.95-0.53,1.3c-0.35,0.35-0.79,0.53-1.3,0.53c-0.52,0-0.96-0.18-1.32-0.53c-0.37-0.35-0.55-0.79-0.55-1.3V65.21
			l-9.38,23.2c-0.22,0.51-0.56,0.93-1.04,1.24c-0.47,0.31-1,0.47-1.56,0.47s-1.09-0.16-1.56-0.47c-0.47-0.31-0.82-0.72-1.04-1.24
			l-9.38-23.2v23.08c0,0.51-0.18,0.95-0.55,1.3s-0.81,0.53-1.32,0.53C147.5,90.11,147.06,89.94,146.71,89.58z" class="st0"/>
|
|
26
|
+
</g>
|
|
27
|
+
</g>
|
|
28
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* Ejecuta una llamada a la API de CiviCRM v4 (Civi-Go)
|
|
4
|
+
* Usa form-urlencoded con el campo "params" serializado
|
|
5
|
+
*/
|
|
6
|
+
export declare function civicrmApiRequest(this: IExecuteFunctions, method: 'POST', path: string, body: Record<string, unknown>): Promise<any>;
|
|
7
|
+
/**
|
|
8
|
+
* Devuelve el cuerpo estΓ‘ndar para las llamadas API4 (plano)
|
|
9
|
+
*/
|
|
10
|
+
export declare function api4(entity: string, action: string, params?: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -7,7 +7,6 @@ const n8n_workflow_1 = require("n8n-workflow");
|
|
|
7
7
|
* Usa form-urlencoded con el campo "params" serializado
|
|
8
8
|
*/
|
|
9
9
|
async function civicrmApiRequest(method, path, body) {
|
|
10
|
-
var _a;
|
|
11
10
|
const { baseUrl, apiToken } = (await this.getCredentials('civiCrmApi'));
|
|
12
11
|
const options = {
|
|
13
12
|
method,
|
|
@@ -18,7 +17,7 @@ async function civicrmApiRequest(method, path, body) {
|
|
|
18
17
|
},
|
|
19
18
|
// cuerpo plano como espera Civi-Go
|
|
20
19
|
body: {
|
|
21
|
-
params: JSON.stringify(
|
|
20
|
+
params: JSON.stringify(body.params ?? body),
|
|
22
21
|
},
|
|
23
22
|
json: true,
|
|
24
23
|
};
|