n8n-nodes-occasio 1.2.0 → 1.2.6
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/README.md +41 -302
- package/dist/config/brand.config.js +7 -7
- package/dist/nodes/ChatPlatform/ChatPlatform.node.d.ts +1 -0
- package/dist/nodes/ChatPlatform/ChatPlatform.node.js +221 -35
- package/package.json +13 -12
- package/dist/credentials/KirimChatApi.credentials.d.ts +0 -9
- package/dist/credentials/KirimChatApi.credentials.js +0 -46
- package/dist/nodes/KirimChat/KirimChat.node.d.ts +0 -10
- package/dist/nodes/KirimChat/KirimChat.node.js +0 -1178
- package/dist/nodes/occasio/KirimChat.node.d.ts +0 -10
- package/dist/nodes/occasio/KirimChat.node.js +0 -1178
- package/dist/nodes/occasio/occasio.svg +0 -6
- /package/dist/nodes/{KirimChat/kirimchat.svg → ChatPlatform/icon.svg} +0 -0
|
@@ -42,6 +42,34 @@ function validateInteractiveMessage(interactive) {
|
|
|
42
42
|
}
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
|
+
const MAX_TEMPLATE_VARS = 20;
|
|
46
|
+
const templateVariableCountOptions = [
|
|
47
|
+
{ name: 'No variables', value: 0 },
|
|
48
|
+
...Array.from({ length: MAX_TEMPLATE_VARS }, (_, i) => ({
|
|
49
|
+
name: `${i + 1}`,
|
|
50
|
+
value: i + 1,
|
|
51
|
+
})),
|
|
52
|
+
];
|
|
53
|
+
// Generate individual template variable fields with displayOptions
|
|
54
|
+
// Each field shows only when templateVariableCount >= its number
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
+
const templateVariableFields = Array.from({ length: MAX_TEMPLATE_VARS }, (_, idx) => {
|
|
57
|
+
const varNum = idx + 1;
|
|
58
|
+
return {
|
|
59
|
+
displayName: `Variable {{${varNum}}}`,
|
|
60
|
+
name: `templateVar${varNum}`,
|
|
61
|
+
type: 'string',
|
|
62
|
+
displayOptions: {
|
|
63
|
+
show: {
|
|
64
|
+
operation: ['sendMessage'],
|
|
65
|
+
messageType: ['template'],
|
|
66
|
+
templateVariableCount: Array.from({ length: MAX_TEMPLATE_VARS - idx }, (_, j) => varNum + j),
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
default: '',
|
|
70
|
+
description: `Value for template placeholder {{${varNum}}}`,
|
|
71
|
+
};
|
|
72
|
+
});
|
|
45
73
|
class ChatPlatform {
|
|
46
74
|
constructor() {
|
|
47
75
|
this.description = {
|
|
@@ -244,6 +272,23 @@ class ChatPlatform {
|
|
|
244
272
|
default: '',
|
|
245
273
|
description: 'Select which Facebook Page to send from. Required if customer has conversations with multiple pages.',
|
|
246
274
|
},
|
|
275
|
+
// WhatsApp Phone Number Selection (Multi-number support)
|
|
276
|
+
{
|
|
277
|
+
displayName: 'WhatsApp Phone Number',
|
|
278
|
+
name: 'whatsappPhoneNumberId',
|
|
279
|
+
type: 'options',
|
|
280
|
+
displayOptions: {
|
|
281
|
+
show: {
|
|
282
|
+
operation: ['sendMessage'],
|
|
283
|
+
channel: ['whatsapp'],
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
typeOptions: {
|
|
287
|
+
loadOptionsMethod: 'getWhatsAppPhoneNumbers',
|
|
288
|
+
},
|
|
289
|
+
default: '',
|
|
290
|
+
description: 'Select which WhatsApp phone number to send from. Required if you have multiple phone numbers connected.',
|
|
291
|
+
},
|
|
247
292
|
// Message Type - WhatsApp
|
|
248
293
|
{
|
|
249
294
|
displayName: 'Message Type',
|
|
@@ -484,19 +529,21 @@ class ChatPlatform {
|
|
|
484
529
|
placeholder: 'en',
|
|
485
530
|
},
|
|
486
531
|
{
|
|
487
|
-
displayName: '
|
|
488
|
-
name: '
|
|
489
|
-
type: '
|
|
532
|
+
displayName: 'Number of Variables',
|
|
533
|
+
name: 'templateVariableCount',
|
|
534
|
+
type: 'options',
|
|
490
535
|
displayOptions: {
|
|
491
536
|
show: {
|
|
492
537
|
operation: ['sendMessage'],
|
|
493
538
|
messageType: ['template'],
|
|
494
539
|
},
|
|
495
540
|
},
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
541
|
+
options: templateVariableCountOptions,
|
|
542
|
+
default: 0,
|
|
543
|
+
noDataExpression: true,
|
|
544
|
+
description: 'Match the variable count shown in template name (e.g., [12 var] = select 12)',
|
|
499
545
|
},
|
|
546
|
+
...templateVariableFields,
|
|
500
547
|
{
|
|
501
548
|
displayName: 'Advanced: Template Components (JSON)',
|
|
502
549
|
name: 'templateComponents',
|
|
@@ -511,6 +558,37 @@ class ChatPlatform {
|
|
|
511
558
|
default: '',
|
|
512
559
|
description: 'For advanced use: Full template components JSON (header media, buttons). Overrides variable fields above if provided.',
|
|
513
560
|
},
|
|
561
|
+
// Auto-create customer (for template messages via phone number)
|
|
562
|
+
{
|
|
563
|
+
displayName: 'Auto-Create Customer',
|
|
564
|
+
name: 'autoCreateCustomer',
|
|
565
|
+
type: 'boolean',
|
|
566
|
+
displayOptions: {
|
|
567
|
+
show: {
|
|
568
|
+
operation: ['sendMessage'],
|
|
569
|
+
messageType: ['template'],
|
|
570
|
+
customerLookup: ['phone_number'],
|
|
571
|
+
},
|
|
572
|
+
},
|
|
573
|
+
default: true,
|
|
574
|
+
description: 'Automatically create a new customer if the phone number is not found. Only works with template messages (outside 24h window).',
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
displayName: 'Customer Name',
|
|
578
|
+
name: 'customerName',
|
|
579
|
+
type: 'string',
|
|
580
|
+
displayOptions: {
|
|
581
|
+
show: {
|
|
582
|
+
operation: ['sendMessage'],
|
|
583
|
+
messageType: ['template'],
|
|
584
|
+
customerLookup: ['phone_number'],
|
|
585
|
+
autoCreateCustomer: [true],
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
default: '',
|
|
589
|
+
description: 'Name for the auto-created customer (optional)',
|
|
590
|
+
placeholder: 'John Doe',
|
|
591
|
+
},
|
|
514
592
|
// ============================================
|
|
515
593
|
// INTERACTIVE MESSAGE FIELDS (WhatsApp only)
|
|
516
594
|
// ============================================
|
|
@@ -833,6 +911,21 @@ class ChatPlatform {
|
|
|
833
911
|
// ============================================
|
|
834
912
|
// LIST TEMPLATES FIELDS
|
|
835
913
|
// ============================================
|
|
914
|
+
{
|
|
915
|
+
displayName: 'WhatsApp Phone Number',
|
|
916
|
+
name: 'templatePhoneNumberId',
|
|
917
|
+
type: 'options',
|
|
918
|
+
displayOptions: {
|
|
919
|
+
show: {
|
|
920
|
+
operation: ['listTemplates'],
|
|
921
|
+
},
|
|
922
|
+
},
|
|
923
|
+
typeOptions: {
|
|
924
|
+
loadOptionsMethod: 'getWhatsAppPhoneNumbers',
|
|
925
|
+
},
|
|
926
|
+
default: '',
|
|
927
|
+
description: 'Filter templates by WhatsApp phone number (each number belongs to a specific WABA with its own templates)',
|
|
928
|
+
},
|
|
836
929
|
{
|
|
837
930
|
displayName: 'Filter by Status',
|
|
838
931
|
name: 'templateStatus',
|
|
@@ -1043,6 +1136,23 @@ class ChatPlatform {
|
|
|
1043
1136
|
default: '',
|
|
1044
1137
|
description: 'The messaging channel to use (leave empty for auto-detect)',
|
|
1045
1138
|
},
|
|
1139
|
+
// WhatsApp Phone Number Selection for Typing (Multi-number support)
|
|
1140
|
+
{
|
|
1141
|
+
displayName: 'WhatsApp Phone Number',
|
|
1142
|
+
name: 'typingWhatsappPhoneNumberId',
|
|
1143
|
+
type: 'options',
|
|
1144
|
+
displayOptions: {
|
|
1145
|
+
show: {
|
|
1146
|
+
operation: ['sendTyping'],
|
|
1147
|
+
typingChannel: ['whatsapp'],
|
|
1148
|
+
},
|
|
1149
|
+
},
|
|
1150
|
+
typeOptions: {
|
|
1151
|
+
loadOptionsMethod: 'getWhatsAppPhoneNumbers',
|
|
1152
|
+
},
|
|
1153
|
+
default: '',
|
|
1154
|
+
description: 'Select which WhatsApp phone number to send typing indicator from',
|
|
1155
|
+
},
|
|
1046
1156
|
// Instagram Account Selection for Typing (Multi-account support)
|
|
1047
1157
|
{
|
|
1048
1158
|
displayName: 'Instagram Account',
|
|
@@ -1081,27 +1191,68 @@ class ChatPlatform {
|
|
|
1081
1191
|
};
|
|
1082
1192
|
this.methods = {
|
|
1083
1193
|
loadOptions: {
|
|
1194
|
+
// Load WhatsApp phone numbers for dropdown (multi-number support)
|
|
1195
|
+
async getWhatsAppPhoneNumbers() {
|
|
1196
|
+
const credentials = await this.getCredentials(brand_config_1.brandConfig.credentialId);
|
|
1197
|
+
const baseUrl = credentials.baseUrl;
|
|
1198
|
+
try {
|
|
1199
|
+
const response = await this.helpers.httpRequest({
|
|
1200
|
+
method: 'GET',
|
|
1201
|
+
url: `${baseUrl}/phone-numbers`,
|
|
1202
|
+
headers: {
|
|
1203
|
+
'Authorization': `Bearer ${credentials.apiKey}`,
|
|
1204
|
+
'Content-Type': 'application/json',
|
|
1205
|
+
},
|
|
1206
|
+
});
|
|
1207
|
+
if (!response.success || !Array.isArray(response.data) || response.data.length === 0) {
|
|
1208
|
+
return [{ name: '-- No WhatsApp numbers connected --', value: '' }];
|
|
1209
|
+
}
|
|
1210
|
+
const phoneNumbers = response.data;
|
|
1211
|
+
// Add "Auto-detect" option at the top
|
|
1212
|
+
const options = [
|
|
1213
|
+
{
|
|
1214
|
+
name: 'Auto-detect (use if single number)',
|
|
1215
|
+
value: '',
|
|
1216
|
+
description: 'Let the system detect the appropriate phone number',
|
|
1217
|
+
},
|
|
1218
|
+
];
|
|
1219
|
+
phoneNumbers.forEach((pn) => {
|
|
1220
|
+
const label = pn.verified_name
|
|
1221
|
+
? `${pn.display_phone_number} (${pn.verified_name})`
|
|
1222
|
+
: pn.display_phone_number;
|
|
1223
|
+
const primary = pn.is_primary ? ' [Primary]' : '';
|
|
1224
|
+
options.push({
|
|
1225
|
+
name: `${label}${primary}`,
|
|
1226
|
+
value: pn.id,
|
|
1227
|
+
description: pn.business_name
|
|
1228
|
+
? `WABA: ${pn.business_name}`
|
|
1229
|
+
: `WhatsApp number ${pn.display_phone_number}`,
|
|
1230
|
+
});
|
|
1231
|
+
});
|
|
1232
|
+
return options;
|
|
1233
|
+
}
|
|
1234
|
+
catch (error) {
|
|
1235
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
1236
|
+
return [{ name: `-- Error: ${errorMessage.substring(0, 50)} --`, value: '' }];
|
|
1237
|
+
}
|
|
1238
|
+
},
|
|
1084
1239
|
// Load Instagram accounts for dropdown (multi-account support)
|
|
1085
1240
|
async getInstagramAccounts() {
|
|
1086
|
-
var _a;
|
|
1087
1241
|
const credentials = await this.getCredentials(brand_config_1.brandConfig.credentialId);
|
|
1088
1242
|
const baseUrl = credentials.baseUrl;
|
|
1089
1243
|
try {
|
|
1090
1244
|
const response = await this.helpers.httpRequest({
|
|
1091
1245
|
method: 'GET',
|
|
1092
|
-
url: `${baseUrl}/accounts
|
|
1246
|
+
url: `${baseUrl}/instagram-accounts`,
|
|
1093
1247
|
headers: {
|
|
1094
1248
|
'Authorization': `Bearer ${credentials.apiKey}`,
|
|
1095
1249
|
'Content-Type': 'application/json',
|
|
1096
1250
|
},
|
|
1097
1251
|
});
|
|
1098
|
-
if (!response.success || !(
|
|
1099
|
-
return [{ name: '-- No accounts found --', value: '' }];
|
|
1100
|
-
}
|
|
1101
|
-
const accounts = response.data.accounts;
|
|
1102
|
-
if (accounts.length === 0) {
|
|
1252
|
+
if (!response.success || !Array.isArray(response.data) || response.data.length === 0) {
|
|
1103
1253
|
return [{ name: '-- No Instagram accounts connected --', value: '' }];
|
|
1104
1254
|
}
|
|
1255
|
+
const accounts = response.data;
|
|
1105
1256
|
// Add "Auto-detect" option at the top
|
|
1106
1257
|
const options = [
|
|
1107
1258
|
{
|
|
@@ -1112,7 +1263,7 @@ class ChatPlatform {
|
|
|
1112
1263
|
];
|
|
1113
1264
|
// Add connected accounts
|
|
1114
1265
|
accounts
|
|
1115
|
-
.filter((a) => a.
|
|
1266
|
+
.filter((a) => a.connection_status === 'connected')
|
|
1116
1267
|
.forEach((account) => {
|
|
1117
1268
|
options.push({
|
|
1118
1269
|
name: `@${account.username}`,
|
|
@@ -1129,25 +1280,21 @@ class ChatPlatform {
|
|
|
1129
1280
|
},
|
|
1130
1281
|
// Load Facebook Pages for dropdown (multi-account support)
|
|
1131
1282
|
async getFacebookPages() {
|
|
1132
|
-
var _a;
|
|
1133
1283
|
const credentials = await this.getCredentials(brand_config_1.brandConfig.credentialId);
|
|
1134
1284
|
const baseUrl = credentials.baseUrl;
|
|
1135
1285
|
try {
|
|
1136
1286
|
const response = await this.helpers.httpRequest({
|
|
1137
1287
|
method: 'GET',
|
|
1138
|
-
url: `${baseUrl}/
|
|
1288
|
+
url: `${baseUrl}/facebook-pages`,
|
|
1139
1289
|
headers: {
|
|
1140
1290
|
'Authorization': `Bearer ${credentials.apiKey}`,
|
|
1141
1291
|
'Content-Type': 'application/json',
|
|
1142
1292
|
},
|
|
1143
1293
|
});
|
|
1144
|
-
if (!response.success || !(
|
|
1145
|
-
return [{ name: '-- No pages found --', value: '' }];
|
|
1146
|
-
}
|
|
1147
|
-
const pages = response.data.pages;
|
|
1148
|
-
if (pages.length === 0) {
|
|
1294
|
+
if (!response.success || !Array.isArray(response.data) || response.data.length === 0) {
|
|
1149
1295
|
return [{ name: '-- No Facebook Pages connected --', value: '' }];
|
|
1150
1296
|
}
|
|
1297
|
+
const pages = response.data;
|
|
1151
1298
|
// Add "Auto-detect" option at the top
|
|
1152
1299
|
const options = [
|
|
1153
1300
|
{
|
|
@@ -1158,12 +1305,12 @@ class ChatPlatform {
|
|
|
1158
1305
|
];
|
|
1159
1306
|
// Add connected pages
|
|
1160
1307
|
pages
|
|
1161
|
-
.filter((p) => p.
|
|
1308
|
+
.filter((p) => p.connection_status === 'connected')
|
|
1162
1309
|
.forEach((page) => {
|
|
1163
1310
|
options.push({
|
|
1164
|
-
name: page.
|
|
1311
|
+
name: page.page_name,
|
|
1165
1312
|
value: page.id,
|
|
1166
|
-
description: `Facebook Page: ${page.
|
|
1313
|
+
description: `Facebook Page: ${page.page_name}`,
|
|
1167
1314
|
});
|
|
1168
1315
|
});
|
|
1169
1316
|
return options;
|
|
@@ -1173,14 +1320,25 @@ class ChatPlatform {
|
|
|
1173
1320
|
return [{ name: `-- Error: ${errorMessage.substring(0, 50)} --`, value: '' }];
|
|
1174
1321
|
}
|
|
1175
1322
|
},
|
|
1176
|
-
// Load templates from API for dropdown
|
|
1323
|
+
// Load templates from API for dropdown (filtered by selected phone number)
|
|
1177
1324
|
async getTemplates() {
|
|
1178
1325
|
const credentials = await this.getCredentials(brand_config_1.brandConfig.credentialId);
|
|
1179
1326
|
const baseUrl = credentials.baseUrl;
|
|
1180
1327
|
try {
|
|
1328
|
+
// Get the selected phone number to filter templates by WABA
|
|
1329
|
+
let phoneNumberFilter = '';
|
|
1330
|
+
try {
|
|
1331
|
+
const selectedPhoneNumber = this.getCurrentNodeParameter('whatsappPhoneNumberId');
|
|
1332
|
+
if (selectedPhoneNumber) {
|
|
1333
|
+
phoneNumberFilter = `&whatsapp_phone_number_id=${selectedPhoneNumber}`;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
catch {
|
|
1337
|
+
// Parameter not available yet, skip filter
|
|
1338
|
+
}
|
|
1181
1339
|
const response = await this.helpers.httpRequest({
|
|
1182
1340
|
method: 'GET',
|
|
1183
|
-
url: `${baseUrl}/templates?status=APPROVED&limit=500`,
|
|
1341
|
+
url: `${baseUrl}/templates?status=APPROVED&limit=500${phoneNumberFilter}`,
|
|
1184
1342
|
headers: {
|
|
1185
1343
|
'Authorization': `Bearer ${credentials.apiKey}`,
|
|
1186
1344
|
'Content-Type': 'application/json',
|
|
@@ -1207,11 +1365,8 @@ class ChatPlatform {
|
|
|
1207
1365
|
value: JSON.stringify({
|
|
1208
1366
|
name: t.template_name,
|
|
1209
1367
|
language: t.language,
|
|
1210
|
-
has_variables: varCount > 0,
|
|
1211
|
-
variable_count: varCount,
|
|
1212
|
-
content: t.content,
|
|
1213
1368
|
}),
|
|
1214
|
-
description: ((_a = t.content) === null || _a === void 0 ? void 0 : _a.substring(0,
|
|
1369
|
+
description: ((_a = t.content) === null || _a === void 0 ? void 0 : _a.substring(0, 100)) || '',
|
|
1215
1370
|
};
|
|
1216
1371
|
});
|
|
1217
1372
|
}
|
|
@@ -1253,6 +1408,13 @@ class ChatPlatform {
|
|
|
1253
1408
|
else if (customerLookup === 'instagram_username') {
|
|
1254
1409
|
body.instagram_username = this.getNodeParameter('instagramUsername', i);
|
|
1255
1410
|
}
|
|
1411
|
+
// Add phone number ID for multi-number support (WhatsApp)
|
|
1412
|
+
if (channel === 'whatsapp') {
|
|
1413
|
+
const whatsappPhoneNumberId = this.getNodeParameter('whatsappPhoneNumberId', i, '');
|
|
1414
|
+
if (whatsappPhoneNumberId) {
|
|
1415
|
+
body.whatsapp_phone_number_id = whatsappPhoneNumberId;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1256
1418
|
// Add account ID for multi-account support (Instagram)
|
|
1257
1419
|
if (channel === 'instagram') {
|
|
1258
1420
|
const instagramAccountId = this.getNodeParameter('instagramAccountId', i, '');
|
|
@@ -1311,11 +1473,13 @@ class ChatPlatform {
|
|
|
1311
1473
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid template selection. Please re-select the template.', { itemIndex: i });
|
|
1312
1474
|
}
|
|
1313
1475
|
}
|
|
1314
|
-
// Handle
|
|
1315
|
-
const
|
|
1316
|
-
const templateVariables =
|
|
1317
|
-
|
|
1318
|
-
|
|
1476
|
+
// Handle template variables from individual fields
|
|
1477
|
+
const templateVarCount = this.getNodeParameter('templateVariableCount', i, 0);
|
|
1478
|
+
const templateVariables = [];
|
|
1479
|
+
for (let v = 1; v <= templateVarCount; v++) {
|
|
1480
|
+
const val = this.getNodeParameter(`templateVar${v}`, i, '');
|
|
1481
|
+
templateVariables.push(val);
|
|
1482
|
+
}
|
|
1319
1483
|
if (templateVariables.length > 0) {
|
|
1320
1484
|
// Build body component with parameters
|
|
1321
1485
|
const bodyParameters = templateVariables.map((v) => ({
|
|
@@ -1337,6 +1501,17 @@ class ChatPlatform {
|
|
|
1337
1501
|
language: { code: templateLanguage },
|
|
1338
1502
|
components: templateComponents,
|
|
1339
1503
|
};
|
|
1504
|
+
// Auto-create customer support (only for phone_number lookup + template)
|
|
1505
|
+
if (customerLookup === 'phone_number') {
|
|
1506
|
+
const autoCreateCustomer = this.getNodeParameter('autoCreateCustomer', i, true);
|
|
1507
|
+
body.auto_create_customer = autoCreateCustomer;
|
|
1508
|
+
if (autoCreateCustomer) {
|
|
1509
|
+
const customerName = this.getNodeParameter('customerName', i, '');
|
|
1510
|
+
if (customerName) {
|
|
1511
|
+
body.customer_name = customerName;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1340
1515
|
}
|
|
1341
1516
|
else if (messageType === 'interactive') {
|
|
1342
1517
|
// WhatsApp interactive message
|
|
@@ -1580,11 +1755,15 @@ class ChatPlatform {
|
|
|
1580
1755
|
// ============================================
|
|
1581
1756
|
// LIST TEMPLATES OPERATION
|
|
1582
1757
|
// ============================================
|
|
1758
|
+
const templatePhoneNumberId = this.getNodeParameter('templatePhoneNumberId', i, '');
|
|
1583
1759
|
const templateStatus = this.getNodeParameter('templateStatus', i, '');
|
|
1584
1760
|
const templateCategory = this.getNodeParameter('templateCategory', i, '');
|
|
1585
1761
|
const templateLimit = this.getNodeParameter('templateLimit', i, 100);
|
|
1586
1762
|
// Build query string
|
|
1587
1763
|
const queryParams = [];
|
|
1764
|
+
if (templatePhoneNumberId) {
|
|
1765
|
+
queryParams.push(`whatsapp_phone_number_id=${templatePhoneNumberId}`);
|
|
1766
|
+
}
|
|
1588
1767
|
if (templateStatus) {
|
|
1589
1768
|
queryParams.push(`status=${templateStatus}`);
|
|
1590
1769
|
}
|
|
@@ -1633,6 +1812,13 @@ class ChatPlatform {
|
|
|
1633
1812
|
if (typingChannel) {
|
|
1634
1813
|
typingBody.channel = typingChannel;
|
|
1635
1814
|
}
|
|
1815
|
+
// Add phone number ID for multi-number support (WhatsApp)
|
|
1816
|
+
if (typingChannel === 'whatsapp') {
|
|
1817
|
+
const whatsappPhoneNumberId = this.getNodeParameter('typingWhatsappPhoneNumberId', i, '');
|
|
1818
|
+
if (whatsappPhoneNumberId) {
|
|
1819
|
+
typingBody.whatsapp_phone_number_id = whatsappPhoneNumberId;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1636
1822
|
// Add account ID for multi-account support (Instagram)
|
|
1637
1823
|
if (typingChannel === 'instagram') {
|
|
1638
1824
|
const instagramAccountId = this.getNodeParameter('typingInstagramAccountId', i, '');
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-occasio",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "n8n community node for
|
|
3
|
+
"version": "1.2.6",
|
|
4
|
+
"description": "n8n community node for ChatPlatform - Send WhatsApp, Instagram & Messenger messages with interactive buttons, flexible customer lookup, and typing indicators",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
7
7
|
"n8n",
|
|
8
|
-
"
|
|
8
|
+
"chatplatform",
|
|
9
9
|
"whatsapp",
|
|
10
10
|
"instagram",
|
|
11
11
|
"messenger",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"automation"
|
|
16
16
|
],
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"homepage": "https://occasio.id",
|
|
18
|
+
"homepage": "https://chat.occasio.id",
|
|
19
19
|
"author": {
|
|
20
|
-
"name": "
|
|
20
|
+
"name": "OccasioChat",
|
|
21
21
|
"email": "support@occasio.id"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/occasio/n8n-nodes-
|
|
25
|
+
"url": "https://github.com/occasio.id/n8n-nodes-occasiochat.git"
|
|
26
26
|
},
|
|
27
|
-
"main": "dist/nodes/
|
|
27
|
+
"main": "dist/nodes/ChatPlatform/ChatPlatform.node.js",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsc && npm run copy-icons",
|
|
30
|
-
"copy-icons": "node -e \"require('fs').cpSync('nodes/ChatPlatform/icon.svg', 'dist/nodes/
|
|
30
|
+
"copy-icons": "node -e \"require('fs').cpSync('nodes/ChatPlatform/icon.svg', 'dist/nodes/ChatPlatform/icon.svg')\"",
|
|
31
31
|
"dev": "tsc --watch",
|
|
32
|
-
"format": "prettier nodes credentials --write",
|
|
33
|
-
"lint": "eslint nodes credentials package.json",
|
|
32
|
+
"format": "prettier nodes credentials config --write",
|
|
33
|
+
"lint": "eslint nodes credentials config package.json",
|
|
34
34
|
"prepublishOnly": "npm run build"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
@@ -49,11 +49,12 @@
|
|
|
49
49
|
"@typescript-eslint/parser": "^7.0.0",
|
|
50
50
|
"copyfiles": "^2.4.1",
|
|
51
51
|
"eslint": "^8.0.0",
|
|
52
|
-
"n8n-
|
|
52
|
+
"n8n-core": "^2.7.2",
|
|
53
|
+
"n8n-workflow": "^1.120.8",
|
|
53
54
|
"prettier": "^3.0.0",
|
|
54
55
|
"typescript": "^5.0.0"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
58
|
"n8n-workflow": "*"
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
export declare class KirimChatApi implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
documentationUrl: string;
|
|
6
|
-
properties: INodeProperties[];
|
|
7
|
-
authenticate: IAuthenticateGeneric;
|
|
8
|
-
test: ICredentialTestRequest;
|
|
9
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KirimChatApi = void 0;
|
|
4
|
-
class KirimChatApi {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = 'kirimChatApi';
|
|
7
|
-
this.displayName = 'KirimChat API';
|
|
8
|
-
this.documentationUrl = 'https://kirim.chat/developers';
|
|
9
|
-
this.properties = [
|
|
10
|
-
{
|
|
11
|
-
displayName: 'API Key',
|
|
12
|
-
name: 'apiKey',
|
|
13
|
-
type: 'string',
|
|
14
|
-
typeOptions: { password: true },
|
|
15
|
-
default: '',
|
|
16
|
-
required: true,
|
|
17
|
-
description: 'Your KirimChat API key (starts with kc_live_)',
|
|
18
|
-
placeholder: 'kc_live_your_api_key_here',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
displayName: 'API Base URL',
|
|
22
|
-
name: 'baseUrl',
|
|
23
|
-
type: 'string',
|
|
24
|
-
default: 'https://api-prod.kirim.chat/api/v1/public',
|
|
25
|
-
required: true,
|
|
26
|
-
description: '⚠️ WARNING: Only change this URL if you know what you\'re doing. Your API key will be sent to this URL. Changing this to an untrusted URL could expose your credentials.',
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
this.authenticate = {
|
|
30
|
-
type: 'generic',
|
|
31
|
-
properties: {
|
|
32
|
-
headers: {
|
|
33
|
-
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
this.test = {
|
|
38
|
-
request: {
|
|
39
|
-
baseURL: '={{$credentials.baseUrl}}',
|
|
40
|
-
url: '/health',
|
|
41
|
-
method: 'GET',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.KirimChatApi = KirimChatApi;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
-
export declare class KirimChat implements INodeType {
|
|
3
|
-
description: INodeTypeDescription;
|
|
4
|
-
methods: {
|
|
5
|
-
loadOptions: {
|
|
6
|
-
getTemplates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
10
|
-
}
|