@renatoascencio/n8n-nodes-chatwoot 0.1.1
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 +186 -0
- package/dist/credentials/ChatwootApi.credentials.d.ts +9 -0
- package/dist/credentials/ChatwootApi.credentials.js +63 -0
- package/dist/credentials/ChatwootApi.credentials.js.map +1 -0
- package/dist/nodes/Chatwoot/Chatwoot.node.d.ts +5 -0
- package/dist/nodes/Chatwoot/Chatwoot.node.js +284 -0
- package/dist/nodes/Chatwoot/Chatwoot.node.js.map +1 -0
- package/dist/nodes/Chatwoot/GenericFunctions.d.ts +6 -0
- package/dist/nodes/Chatwoot/GenericFunctions.js +160 -0
- package/dist/nodes/Chatwoot/GenericFunctions.js.map +1 -0
- package/dist/nodes/Chatwoot/chatwoot.svg +7 -0
- package/dist/nodes/Chatwoot/resources/contact/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/create.operation.js +78 -0
- package/dist/nodes/Chatwoot/resources/contact/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/delete.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/delete.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/contact/delete.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/get.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/contact/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/getAll.operation.js +93 -0
- package/dist/nodes/Chatwoot/resources/contact/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/contact/index.js +68 -0
- package/dist/nodes/Chatwoot/resources/contact/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/search.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/search.operation.js +107 -0
- package/dist/nodes/Chatwoot/resources/contact/search.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/contact/update.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/contact/update.operation.js +86 -0
- package/dist/nodes/Chatwoot/resources/contact/update.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/get.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/get.operation.js +20 -0
- package/dist/nodes/Chatwoot/resources/conversation/get.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/getAll.operation.js +145 -0
- package/dist/nodes/Chatwoot/resources/conversation/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/conversation/index.js +44 -0
- package/dist/nodes/Chatwoot/resources/conversation/index.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/conversation/updateStatus.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/conversation/updateStatus.operation.js +70 -0
- package/dist/nodes/Chatwoot/resources/conversation/updateStatus.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/message/create.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/message/create.operation.js +117 -0
- package/dist/nodes/Chatwoot/resources/message/create.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/message/getAll.operation.d.ts +2 -0
- package/dist/nodes/Chatwoot/resources/message/getAll.operation.js +51 -0
- package/dist/nodes/Chatwoot/resources/message/getAll.operation.js.map +1 -0
- package/dist/nodes/Chatwoot/resources/message/index.d.ts +3 -0
- package/dist/nodes/Chatwoot/resources/message/index.js +33 -0
- package/dist/nodes/Chatwoot/resources/message/index.js.map +1 -0
- package/dist/nodes/Chatwoot/types.d.ts +99 -0
- package/dist/nodes/Chatwoot/types.js +3 -0
- package/dist/nodes/Chatwoot/types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chatwootApiRequest = chatwootApiRequest;
|
|
4
|
+
exports.chatwootApiRequestAllItems = chatwootApiRequestAllItems;
|
|
5
|
+
exports.chatwootApiRequestAllMessages = chatwootApiRequestAllMessages;
|
|
6
|
+
exports.simplifyResponse = simplifyResponse;
|
|
7
|
+
exports.validateId = validateId;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
function normalizeBaseUrl(baseUrl) {
|
|
10
|
+
return baseUrl.trim().replace(/\/+$/, '');
|
|
11
|
+
}
|
|
12
|
+
function getErrorMessage(statusCode, defaultMessage) {
|
|
13
|
+
const errorMessages = {
|
|
14
|
+
400: 'Bad Request: The request was invalid. Please check your input parameters.',
|
|
15
|
+
401: 'Unauthorized: Invalid API token. Please verify your API Access Token in Chatwoot Profile Settings.',
|
|
16
|
+
403: 'Forbidden: You do not have permission to access this resource. Check your user role and inbox permissions.',
|
|
17
|
+
404: 'Not Found: The requested resource does not exist. Please verify the ID is correct.',
|
|
18
|
+
422: 'Unprocessable Entity: The request data is invalid. Please check required fields and data formats.',
|
|
19
|
+
429: 'Rate Limited: Too many requests. Please wait before making more requests (limit: 60/minute).',
|
|
20
|
+
500: 'Server Error: Chatwoot server encountered an error. Please try again later.',
|
|
21
|
+
502: 'Bad Gateway: Chatwoot server is temporarily unavailable. Please try again later.',
|
|
22
|
+
503: 'Service Unavailable: Chatwoot is undergoing maintenance. Please try again later.',
|
|
23
|
+
};
|
|
24
|
+
return errorMessages[statusCode] || defaultMessage;
|
|
25
|
+
}
|
|
26
|
+
async function chatwootApiRequest(method, endpoint, body = {}, qs = {}) {
|
|
27
|
+
const credentials = await this.getCredentials('chatwootApi');
|
|
28
|
+
const baseUrl = normalizeBaseUrl(credentials.baseUrl);
|
|
29
|
+
const accountId = credentials.accountId;
|
|
30
|
+
const options = {
|
|
31
|
+
method,
|
|
32
|
+
uri: `${baseUrl}/api/v1/accounts/${accountId}${endpoint}`,
|
|
33
|
+
headers: {
|
|
34
|
+
api_access_token: credentials.apiAccessToken,
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
},
|
|
37
|
+
qs,
|
|
38
|
+
body,
|
|
39
|
+
json: true,
|
|
40
|
+
};
|
|
41
|
+
if (method === 'GET' || method === 'DELETE' || Object.keys(body).length === 0) {
|
|
42
|
+
delete options.body;
|
|
43
|
+
}
|
|
44
|
+
if (Object.keys(qs).length === 0) {
|
|
45
|
+
delete options.qs;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const response = await this.helpers.request(options);
|
|
49
|
+
return response;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const statusCode = error.statusCode;
|
|
53
|
+
const message = getErrorMessage(statusCode, error.message || 'An unexpected error occurred');
|
|
54
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, {
|
|
55
|
+
message,
|
|
56
|
+
description: `Failed to ${method} ${endpoint}`,
|
|
57
|
+
httpCode: statusCode === null || statusCode === void 0 ? void 0 : statusCode.toString(),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function chatwootApiRequestAllItems(method, endpoint, body = {}, qs = {}, propertyName = 'payload') {
|
|
62
|
+
const returnData = [];
|
|
63
|
+
let page = 1;
|
|
64
|
+
const perPage = 25;
|
|
65
|
+
qs.page = page;
|
|
66
|
+
let responseData;
|
|
67
|
+
let items;
|
|
68
|
+
do {
|
|
69
|
+
qs.page = page;
|
|
70
|
+
responseData = (await chatwootApiRequest.call(this, method, endpoint, body, qs));
|
|
71
|
+
if (responseData[propertyName] && Array.isArray(responseData[propertyName])) {
|
|
72
|
+
items = responseData[propertyName];
|
|
73
|
+
}
|
|
74
|
+
else if (responseData.data && Array.isArray(responseData.data)) {
|
|
75
|
+
items = responseData.data;
|
|
76
|
+
}
|
|
77
|
+
else if (Array.isArray(responseData)) {
|
|
78
|
+
items = responseData;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
items = [];
|
|
82
|
+
}
|
|
83
|
+
returnData.push(...items);
|
|
84
|
+
page++;
|
|
85
|
+
const meta = responseData.meta;
|
|
86
|
+
if (meta) {
|
|
87
|
+
const totalPages = meta.total_pages;
|
|
88
|
+
const currentPage = meta.current_page;
|
|
89
|
+
if (totalPages && currentPage && currentPage >= totalPages) {
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (items.length < perPage) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
if (page > 100) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
} while (items.length > 0);
|
|
100
|
+
return returnData;
|
|
101
|
+
}
|
|
102
|
+
async function chatwootApiRequestAllMessages(conversationId, limit) {
|
|
103
|
+
const returnData = [];
|
|
104
|
+
let before;
|
|
105
|
+
const perRequest = 20;
|
|
106
|
+
let hasMore = true;
|
|
107
|
+
while (hasMore) {
|
|
108
|
+
const qs = {};
|
|
109
|
+
if (before) {
|
|
110
|
+
qs.before = before;
|
|
111
|
+
}
|
|
112
|
+
const response = (await chatwootApiRequest.call(this, 'GET', `/conversations/${conversationId}/messages`, {}, qs));
|
|
113
|
+
let messages;
|
|
114
|
+
if (response.payload && Array.isArray(response.payload)) {
|
|
115
|
+
messages = response.payload;
|
|
116
|
+
}
|
|
117
|
+
else if (Array.isArray(response)) {
|
|
118
|
+
messages = response;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
messages = [];
|
|
122
|
+
}
|
|
123
|
+
if (messages.length === 0) {
|
|
124
|
+
hasMore = false;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
returnData.push(...messages);
|
|
128
|
+
const oldestMessage = messages[messages.length - 1];
|
|
129
|
+
before = oldestMessage.id;
|
|
130
|
+
if (limit && returnData.length >= limit) {
|
|
131
|
+
return returnData.slice(0, limit);
|
|
132
|
+
}
|
|
133
|
+
if (messages.length < perRequest) {
|
|
134
|
+
hasMore = false;
|
|
135
|
+
}
|
|
136
|
+
if (returnData.length > 10000) {
|
|
137
|
+
hasMore = false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return returnData;
|
|
141
|
+
}
|
|
142
|
+
function simplifyResponse(items, fieldsToKeep) {
|
|
143
|
+
return items.map((item) => {
|
|
144
|
+
const simplified = {};
|
|
145
|
+
for (const field of fieldsToKeep) {
|
|
146
|
+
if (item[field] !== undefined) {
|
|
147
|
+
simplified[field] = item[field];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return simplified;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function validateId(value, fieldName) {
|
|
154
|
+
const num = Number(value);
|
|
155
|
+
if (isNaN(num) || num < 1 || !Number.isInteger(num)) {
|
|
156
|
+
throw new Error(`${fieldName} must be a positive integer`);
|
|
157
|
+
}
|
|
158
|
+
return num;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Chatwoot/GenericFunctions.ts"],"names":[],"mappings":";;AAwCA,gDAkDC;AAMD,gEAyDC;AAMD,sEA8DC;AAKD,4CAUC;AAKD,gCAMC;AA9OD,+CAA4C;AAK5C,SAAS,gBAAgB,CAAC,OAAe;IACvC,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAKD,SAAS,eAAe,CAAC,UAAkB,EAAE,cAAsB;IACjE,MAAM,aAAa,GAA2B;QAC5C,GAAG,EAAE,2EAA2E;QAChF,GAAG,EAAE,oGAAoG;QACzG,GAAG,EAAE,4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EAAE,CAAC;YACjC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC9B,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC;AAKD,SAAgB,UAAU,CAAC,KAAc,EAAE,SAAiB;IAC1D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,6BAA6B,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="none">
|
|
2
|
+
<rect width="512" height="512" rx="100" fill="#1F93FF"/>
|
|
3
|
+
<path d="M256 96c-88.4 0-160 65.5-160 146.3 0 45.5 23.5 86.3 60.5 113.8l-12.8 51.2c-1.9 7.5 5.5 14 12.6 11l62.7-26.1c11.8 3.2 24.3 4.9 37 4.9 88.4 0 160-65.5 160-146.3S344.4 96 256 96z" fill="white"/>
|
|
4
|
+
<circle cx="180" cy="242" r="24" fill="#1F93FF"/>
|
|
5
|
+
<circle cx="256" cy="242" r="24" fill="#1F93FF"/>
|
|
6
|
+
<circle cx="332" cy="242" r="24" fill="#1F93FF"/>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOperation = void 0;
|
|
4
|
+
exports.createOperation = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Inbox ID',
|
|
7
|
+
name: 'inboxId',
|
|
8
|
+
type: 'number',
|
|
9
|
+
required: true,
|
|
10
|
+
default: 0,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['contact'],
|
|
14
|
+
operation: ['create'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
description: 'The inbox ID to associate the contact with. Find this in Chatwoot under Settings → Inboxes.',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Name',
|
|
21
|
+
name: 'name',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: '',
|
|
24
|
+
displayOptions: {
|
|
25
|
+
show: {
|
|
26
|
+
resource: ['contact'],
|
|
27
|
+
operation: ['create'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
description: 'Full name of the contact',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Additional Fields',
|
|
34
|
+
name: 'additionalFields',
|
|
35
|
+
type: 'collection',
|
|
36
|
+
placeholder: 'Add Field',
|
|
37
|
+
default: {},
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
resource: ['contact'],
|
|
41
|
+
operation: ['create'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Email',
|
|
47
|
+
name: 'email',
|
|
48
|
+
type: 'string',
|
|
49
|
+
placeholder: 'name@email.com',
|
|
50
|
+
default: '',
|
|
51
|
+
description: 'Email address of the contact',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Identifier',
|
|
55
|
+
name: 'identifier',
|
|
56
|
+
type: 'string',
|
|
57
|
+
default: '',
|
|
58
|
+
description: 'A unique external identifier for the contact from your system (e.g., user ID)',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Phone Number',
|
|
62
|
+
name: 'phone_number',
|
|
63
|
+
type: 'string',
|
|
64
|
+
placeholder: '+1234567890',
|
|
65
|
+
default: '',
|
|
66
|
+
description: 'Phone number with country code',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Custom Attributes',
|
|
70
|
+
name: 'custom_attributes',
|
|
71
|
+
type: 'json',
|
|
72
|
+
default: '{}',
|
|
73
|
+
description: 'Custom attributes as a JSON object (e.g., {"plan": "premium", "company": "Acme Inc"})',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
//# sourceMappingURL=create.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.operation.js","sourceRoot":"","sources":["../../../../../nodes/Chatwoot/resources/contact/create.operation.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB;IAChD;QACE,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC;QACV,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB;SACF;QACD,WAAW,EACT,6FAA6F;KAChG;IACD;QACE,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB;SACF;QACD,WAAW,EAAE,0BAA0B;KACxC;IACD;QACE,WAAW,EAAE,mBAAmB;QAChC,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB;SACF;QACD,OAAO,EAAE;YACP;gBACE,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gBAAgB;gBAC7B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,8BAA8B;aAC5C;YACD;gBACE,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACT,+EAA+E;aAClF;YACD;gBACE,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,aAAa;gBAC1B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,gCAAgC;aAC9C;YACD;gBACE,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,IAAI;gBACb,WAAW,EACT,uFAAuF;aAC1F;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteOperation = void 0;
|
|
4
|
+
exports.deleteOperation = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Contact ID',
|
|
7
|
+
name: 'contactId',
|
|
8
|
+
type: 'number',
|
|
9
|
+
required: true,
|
|
10
|
+
default: 0,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['contact'],
|
|
14
|
+
operation: ['delete'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
description: 'The ID of the contact to delete',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=delete.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.operation.js","sourceRoot":"","sources":["../../../../../nodes/Chatwoot/resources/contact/delete.operation.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB;IAChD;QACE,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC;QACV,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB;SACF;QACD,WAAW,EAAE,iCAAiC;KAC/C;CACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOperation = void 0;
|
|
4
|
+
exports.getOperation = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Contact ID',
|
|
7
|
+
name: 'contactId',
|
|
8
|
+
type: 'number',
|
|
9
|
+
required: true,
|
|
10
|
+
default: 0,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['contact'],
|
|
14
|
+
operation: ['get'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
description: 'The ID of the contact to retrieve',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=get.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.operation.js","sourceRoot":"","sources":["../../../../../nodes/Chatwoot/resources/contact/get.operation.ts"],"names":[],"mappings":";;;AAEa,QAAA,YAAY,GAAsB;IAC7C;QACE,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC;QACV,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,KAAK,CAAC;aACnB;SACF;QACD,WAAW,EAAE,mCAAmC;KACjD;CACF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllOperation = void 0;
|
|
4
|
+
exports.getAllOperation = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Return All',
|
|
7
|
+
name: 'returnAll',
|
|
8
|
+
type: 'boolean',
|
|
9
|
+
default: false,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['contact'],
|
|
13
|
+
operation: ['getAll'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: 'Limit',
|
|
20
|
+
name: 'limit',
|
|
21
|
+
type: 'number',
|
|
22
|
+
default: 50,
|
|
23
|
+
typeOptions: {
|
|
24
|
+
minValue: 1,
|
|
25
|
+
maxValue: 100,
|
|
26
|
+
},
|
|
27
|
+
displayOptions: {
|
|
28
|
+
show: {
|
|
29
|
+
resource: ['contact'],
|
|
30
|
+
operation: ['getAll'],
|
|
31
|
+
returnAll: [false],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
description: 'Max number of results to return',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
displayName: 'Options',
|
|
38
|
+
name: 'options',
|
|
39
|
+
type: 'collection',
|
|
40
|
+
placeholder: 'Add Option',
|
|
41
|
+
default: {},
|
|
42
|
+
displayOptions: {
|
|
43
|
+
show: {
|
|
44
|
+
resource: ['contact'],
|
|
45
|
+
operation: ['getAll'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Sort By',
|
|
51
|
+
name: 'sort',
|
|
52
|
+
type: 'options',
|
|
53
|
+
default: 'name',
|
|
54
|
+
options: [
|
|
55
|
+
{
|
|
56
|
+
name: 'Email (A-Z)',
|
|
57
|
+
value: 'email',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Email (Z-A)',
|
|
61
|
+
value: '-email',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Last Activity (Newest)',
|
|
65
|
+
value: '-last_activity_at',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Last Activity (Oldest)',
|
|
69
|
+
value: 'last_activity_at',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'Name (A-Z)',
|
|
73
|
+
value: 'name',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'Name (Z-A)',
|
|
77
|
+
value: '-name',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'Phone Number (A-Z)',
|
|
81
|
+
value: 'phone_number',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'Phone Number (Z-A)',
|
|
85
|
+
value: '-phone_number',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
description: 'Sort contacts by field (prefix with - for descending)',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
//# sourceMappingURL=getAll.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAll.operation.js","sourceRoot":"","sources":["../../../../../nodes/Chatwoot/resources/contact/getAll.operation.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB;IAChD;QACE,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB;SACF;QACD,WAAW,EAAE,2DAA2D;KACzE;IACD;QACE,WAAW,EAAE,OAAO;QACpB,I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;gBACD,WAAW,EAAE,uDAAuD;aACrE;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contactFields = exports.contactOperations = void 0;
|
|
4
|
+
const create_operation_1 = require("./create.operation");
|
|
5
|
+
const get_operation_1 = require("./get.operation");
|
|
6
|
+
const getAll_operation_1 = require("./getAll.operation");
|
|
7
|
+
const update_operation_1 = require("./update.operation");
|
|
8
|
+
const delete_operation_1 = require("./delete.operation");
|
|
9
|
+
const search_operation_1 = require("./search.operation");
|
|
10
|
+
exports.contactOperations = {
|
|
11
|
+
displayName: 'Operation',
|
|
12
|
+
name: 'operation',
|
|
13
|
+
type: 'options',
|
|
14
|
+
noDataExpression: true,
|
|
15
|
+
displayOptions: {
|
|
16
|
+
show: {
|
|
17
|
+
resource: ['contact'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
options: [
|
|
21
|
+
{
|
|
22
|
+
name: 'Create',
|
|
23
|
+
value: 'create',
|
|
24
|
+
description: 'Create a new contact',
|
|
25
|
+
action: 'Create a contact',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Delete',
|
|
29
|
+
value: 'delete',
|
|
30
|
+
description: 'Delete a contact',
|
|
31
|
+
action: 'Delete a contact',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Get',
|
|
35
|
+
value: 'get',
|
|
36
|
+
description: 'Get a contact by ID',
|
|
37
|
+
action: 'Get a contact',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Get Many',
|
|
41
|
+
value: 'getAll',
|
|
42
|
+
description: 'Get many contacts',
|
|
43
|
+
action: 'Get many contacts',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Search',
|
|
47
|
+
value: 'search',
|
|
48
|
+
description: 'Search contacts by name, email, phone, or identifier',
|
|
49
|
+
action: 'Search contacts',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Update',
|
|
53
|
+
value: 'update',
|
|
54
|
+
description: 'Update a contact',
|
|
55
|
+
action: 'Update a contact',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
default: 'getAll',
|
|
59
|
+
};
|
|
60
|
+
exports.contactFields = [
|
|
61
|
+
...create_operation_1.createOperation,
|
|
62
|
+
...get_operation_1.getOperation,
|
|
63
|
+
...getAll_operation_1.getAllOperation,
|
|
64
|
+
...update_operation_1.updateOperation,
|
|
65
|
+
...delete_operation_1.deleteOperation,
|
|
66
|
+
...search_operation_1.searchOperation,
|
|
67
|
+
];
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Chatwoot/resources/contact/index.ts"],"names":[],"mappings":";;;AACA,yDAAqD;AACrD,mDAA+C;AAC/C,yDAAqD;AACrD,yDAAqD;AACrD,yDAAqD;AACrD,yDAAqD;AAExC,QAAA,iBAAiB,GAAoB;IAChD,WAAW,EAAE,WAAW;IACxB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE;QACd,IAAI,EAAE;YACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,sBAAsB;YACnC,MAAM,EAAE,kBAAkB;SAC3B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,kBAAkB;YAC/B,MAAM,EAAE,kBAAkB;SAC3B;QACD;YACE,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,qBAAqB;YAClC,MAAM,EAAE,eAAe;SACxB;QACD;YACE,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,mBAAmB;YAChC,MAAM,EAAE,mBAAmB;SAC5B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,sDAAsD;YACnE,MAAM,EAAE,iBAAiB;SAC1B;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,kBAAkB;YAC/B,MAAM,EAAE,kBAAkB;SAC3B;KACF;IACD,OAAO,EAAE,QAAQ;CAClB,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC9C,GAAG,kCAAe;IAClB,GAAG,4BAAY;IACf,GAAG,kCAAe;IAClB,GAAG,kCAAe;IAClB,GAAG,kCAAe;IAClB,GAAG,kCAAe;CACnB,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchOperation = void 0;
|
|
4
|
+
exports.searchOperation = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Query',
|
|
7
|
+
name: 'query',
|
|
8
|
+
type: 'string',
|
|
9
|
+
required: true,
|
|
10
|
+
default: '',
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['contact'],
|
|
14
|
+
operation: ['search'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
description: 'Search query to find contacts by name, email, phone number, or identifier',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Return All',
|
|
21
|
+
name: 'returnAll',
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
default: false,
|
|
24
|
+
displayOptions: {
|
|
25
|
+
show: {
|
|
26
|
+
resource: ['contact'],
|
|
27
|
+
operation: ['search'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Limit',
|
|
34
|
+
name: 'limit',
|
|
35
|
+
type: 'number',
|
|
36
|
+
default: 50,
|
|
37
|
+
typeOptions: {
|
|
38
|
+
minValue: 1,
|
|
39
|
+
maxValue: 100,
|
|
40
|
+
},
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
resource: ['contact'],
|
|
44
|
+
operation: ['search'],
|
|
45
|
+
returnAll: [false],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
description: 'Max number of results to return',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Options',
|
|
52
|
+
name: 'options',
|
|
53
|
+
type: 'collection',
|
|
54
|
+
placeholder: 'Add Option',
|
|
55
|
+
default: {},
|
|
56
|
+
displayOptions: {
|
|
57
|
+
show: {
|
|
58
|
+
resource: ['contact'],
|
|
59
|
+
operation: ['search'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Sort By',
|
|
65
|
+
name: 'sort',
|
|
66
|
+
type: 'options',
|
|
67
|
+
default: 'name',
|
|
68
|
+
options: [
|
|
69
|
+
{
|
|
70
|
+
name: 'Email (A-Z)',
|
|
71
|
+
value: 'email',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'Email (Z-A)',
|
|
75
|
+
value: '-email',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Last Activity (Newest)',
|
|
79
|
+
value: '-last_activity_at',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'Last Activity (Oldest)',
|
|
83
|
+
value: 'last_activity_at',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'Name (A-Z)',
|
|
87
|
+
value: 'name',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'Name (Z-A)',
|
|
91
|
+
value: '-name',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'Phone Number (A-Z)',
|
|
95
|
+
value: 'phone_number',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'Phone Number (Z-A)',
|
|
99
|
+
value: '-phone_number',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
description: 'Sort contacts by field (prefix with - for descending)',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
//# sourceMappingURL=search.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.operation.js","sourceRoot":"","sources":["../../../../../nodes/Chatwoot/resources/contact/search.operation.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAsB;IAChD;QACE,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB;SACF;QACD,WAAW,EAAE,2EAA2E;KACzF;IACD;QACE,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB;SACF;QACD,WAAW,EAAE,2DAA2D;KACzE;IACD;QACE,WAAW,EAAE,OAAO;QACpB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE;YACX,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,GAAG;SACd;QACD,cAAc,EAAE;YACd,IAAI,EAAE;gBACJ,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAA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