n8n-nodes-digitalsac 0.4.0 → 0.4.2
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 +14 -2
- package/dist/nodes/Digitalsac/Digitalsac.node.js +108 -1
- package/nodes/Digitalsac/Digitalsac.node.ts +111 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -384,13 +384,25 @@ Cria um novo agendamento no sistema.
|
|
|
384
384
|
- **Nome do Contato**: Nome do cliente
|
|
385
385
|
- **Telefone do Contato**: Telefone do cliente (formato: 5511999999999)
|
|
386
386
|
- **Observações** (opcional): Notas sobre o agendamento
|
|
387
|
+
- **ID da Conexão WhatsApp** (opcional): ID da conexão WhatsApp (usa primeira disponível se não informado)
|
|
388
|
+
- **Mensagem Personalizada** (opcional): Mensagem personalizada do agendamento
|
|
389
|
+
- **Lembretes (minutos)**: Lembretes em minutos antes do agendamento (separados por vírgula, ex: 60,240,1440)
|
|
390
|
+
- **Duração do Intervalo (minutos)**: Duração do intervalo em minutos (padrão: 30)
|
|
391
|
+
- **Fechar Ticket**: Se deve fechar o ticket após criar agendamento
|
|
392
|
+
|
|
393
|
+
**Observações importantes:**
|
|
394
|
+
- Se o contato não existir no sistema, ele será criado automaticamente
|
|
395
|
+
- Se não informar conexão WhatsApp, será usada a primeira disponível
|
|
396
|
+
- Os lembretes são em minutos (60 = 1 hora, 240 = 4 horas, 1440 = 1 dia)
|
|
387
397
|
|
|
388
398
|
**Retorno exemplo:**
|
|
389
399
|
```json
|
|
390
400
|
{
|
|
391
|
-
"status":
|
|
401
|
+
"status": 1,
|
|
392
402
|
"mensagem": "Agendamento criado com sucesso",
|
|
393
|
-
"scheduleId": 123
|
|
403
|
+
"scheduleId": 123,
|
|
404
|
+
"contactId": 456,
|
|
405
|
+
"whatsappId": 789
|
|
394
406
|
}
|
|
395
407
|
```
|
|
396
408
|
|
|
@@ -47,6 +47,7 @@ class Digitalsac {
|
|
|
47
47
|
{ name: 'Listar Serviços', value: 'listServices' },
|
|
48
48
|
{ name: 'Listar Usuários Disponíveis', value: 'listAvailableUsers' },
|
|
49
49
|
{ name: 'Listar Horários Disponíveis', value: 'listAvailableSlots' },
|
|
50
|
+
{ name: 'Listar Agendamentos', value: 'listSchedules' },
|
|
50
51
|
{ name: 'Criar Agendamento', value: 'createSchedule' },
|
|
51
52
|
{ name: 'Cancelar Agendamento', value: 'cancelSchedule' },
|
|
52
53
|
],
|
|
@@ -320,6 +321,92 @@ class Digitalsac {
|
|
|
320
321
|
},
|
|
321
322
|
description: 'Observações sobre o agendamento (opcional)',
|
|
322
323
|
},
|
|
324
|
+
{
|
|
325
|
+
displayName: 'ID da Conexão WhatsApp',
|
|
326
|
+
name: 'whatsappId',
|
|
327
|
+
type: 'number',
|
|
328
|
+
default: 0,
|
|
329
|
+
displayOptions: {
|
|
330
|
+
show: {
|
|
331
|
+
operation: ['createSchedule'],
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
description: 'ID da conexão WhatsApp (opcional - usa primeira disponível se não informado)',
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
displayName: 'Mensagem Personalizada',
|
|
338
|
+
name: 'customMessage',
|
|
339
|
+
type: 'string',
|
|
340
|
+
default: '',
|
|
341
|
+
displayOptions: {
|
|
342
|
+
show: {
|
|
343
|
+
operation: ['createSchedule'],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
description: 'Mensagem personalizada do agendamento (opcional)',
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
displayName: 'Lembretes (minutos)',
|
|
350
|
+
name: 'reminders',
|
|
351
|
+
type: 'string',
|
|
352
|
+
default: '60,240',
|
|
353
|
+
placeholder: '60,240,1440',
|
|
354
|
+
displayOptions: {
|
|
355
|
+
show: {
|
|
356
|
+
operation: ['createSchedule'],
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
description: 'Lembretes em minutos antes do agendamento (separados por vírgula)',
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
displayName: 'Duração do Intervalo (minutos)',
|
|
363
|
+
name: 'intervalDuration',
|
|
364
|
+
type: 'number',
|
|
365
|
+
default: 30,
|
|
366
|
+
displayOptions: {
|
|
367
|
+
show: {
|
|
368
|
+
operation: ['createSchedule'],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
description: 'Duração do intervalo em minutos',
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
displayName: 'Fechar Ticket',
|
|
375
|
+
name: 'closeTicket',
|
|
376
|
+
type: 'boolean',
|
|
377
|
+
default: false,
|
|
378
|
+
displayOptions: {
|
|
379
|
+
show: {
|
|
380
|
+
operation: ['createSchedule'],
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
description: 'Se deve fechar o ticket após criar agendamento',
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
displayName: 'Data',
|
|
387
|
+
name: 'listScheduleDate',
|
|
388
|
+
type: 'string',
|
|
389
|
+
default: '',
|
|
390
|
+
placeholder: '2025-08-08',
|
|
391
|
+
displayOptions: {
|
|
392
|
+
show: {
|
|
393
|
+
operation: ['listSchedules'],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
description: 'Data no formato YYYY-MM-DD para listar agendamentos',
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
displayName: 'User ID (Opcional)',
|
|
400
|
+
name: 'listScheduleUserId',
|
|
401
|
+
type: 'number',
|
|
402
|
+
default: 0,
|
|
403
|
+
displayOptions: {
|
|
404
|
+
show: {
|
|
405
|
+
operation: ['listSchedules'],
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
description: 'ID do usuário para filtrar agendamentos (opcional)',
|
|
409
|
+
},
|
|
323
410
|
{
|
|
324
411
|
displayName: 'ID do Agendamento',
|
|
325
412
|
name: 'scheduleId',
|
|
@@ -617,6 +704,14 @@ class Digitalsac {
|
|
|
617
704
|
const dateForSlots = this.getNodeParameter('scheduleDate', i);
|
|
618
705
|
url = `/typebot/listar_horarios_disponiveis?serviceId=${serviceIdForSlots}&userId=${userIdForSlots}&date=${dateForSlots}`;
|
|
619
706
|
break;
|
|
707
|
+
case 'listSchedules':
|
|
708
|
+
const dateForList = this.getNodeParameter('listScheduleDate', i);
|
|
709
|
+
const userIdForList = this.getNodeParameter('listScheduleUserId', i);
|
|
710
|
+
url = `/typebot/listar_agendamentos?date=${dateForList}`;
|
|
711
|
+
if (userIdForList && userIdForList > 0) {
|
|
712
|
+
url += `&userId=${userIdForList}`;
|
|
713
|
+
}
|
|
714
|
+
break;
|
|
620
715
|
case 'createSchedule':
|
|
621
716
|
url = '/typebot/criar_agendamento';
|
|
622
717
|
method = 'POST';
|
|
@@ -627,6 +722,13 @@ class Digitalsac {
|
|
|
627
722
|
const contactNameForCreate = this.getNodeParameter('contactName', i);
|
|
628
723
|
const contactPhoneForCreate = this.getNodeParameter('contactPhone', i);
|
|
629
724
|
const notesForCreate = this.getNodeParameter('scheduleNotes', i);
|
|
725
|
+
const whatsappIdForCreate = this.getNodeParameter('whatsappId', i);
|
|
726
|
+
const customMessageForCreate = this.getNodeParameter('customMessage', i);
|
|
727
|
+
const remindersForCreate = this.getNodeParameter('reminders', i);
|
|
728
|
+
const intervalDurationForCreate = this.getNodeParameter('intervalDuration', i);
|
|
729
|
+
const closeTicketForCreate = this.getNodeParameter('closeTicket', i);
|
|
730
|
+
// Converter string de lembretes para array
|
|
731
|
+
const remindersArray = remindersForCreate ? remindersForCreate.split(',').map(r => parseInt(r.trim())) : [60, 240];
|
|
630
732
|
body = {
|
|
631
733
|
serviceId: serviceIdForCreate,
|
|
632
734
|
userId: userIdForCreate,
|
|
@@ -634,7 +736,12 @@ class Digitalsac {
|
|
|
634
736
|
time: timeForCreate,
|
|
635
737
|
contactName: contactNameForCreate,
|
|
636
738
|
contactPhone: contactPhoneForCreate,
|
|
637
|
-
notes: notesForCreate
|
|
739
|
+
notes: notesForCreate,
|
|
740
|
+
whatsappId: whatsappIdForCreate > 0 ? whatsappIdForCreate : undefined,
|
|
741
|
+
message: customMessageForCreate || undefined,
|
|
742
|
+
reminders: remindersArray,
|
|
743
|
+
intervalDuration: intervalDurationForCreate,
|
|
744
|
+
closeTicket: closeTicketForCreate
|
|
638
745
|
};
|
|
639
746
|
headers['Content-Type'] = 'application/json';
|
|
640
747
|
options = {
|
|
@@ -54,6 +54,7 @@ export class Digitalsac implements INodeType {
|
|
|
54
54
|
{ name: 'Listar Serviços', value: 'listServices' },
|
|
55
55
|
{ name: 'Listar Usuários Disponíveis', value: 'listAvailableUsers' },
|
|
56
56
|
{ name: 'Listar Horários Disponíveis', value: 'listAvailableSlots' },
|
|
57
|
+
{ name: 'Listar Agendamentos', value: 'listSchedules' },
|
|
57
58
|
{ name: 'Criar Agendamento', value: 'createSchedule' },
|
|
58
59
|
{ name: 'Cancelar Agendamento', value: 'cancelSchedule' },
|
|
59
60
|
],
|
|
@@ -327,6 +328,92 @@ export class Digitalsac implements INodeType {
|
|
|
327
328
|
},
|
|
328
329
|
description: 'Observações sobre o agendamento (opcional)',
|
|
329
330
|
},
|
|
331
|
+
{
|
|
332
|
+
displayName: 'ID da Conexão WhatsApp',
|
|
333
|
+
name: 'whatsappId',
|
|
334
|
+
type: 'number',
|
|
335
|
+
default: 0,
|
|
336
|
+
displayOptions: {
|
|
337
|
+
show: {
|
|
338
|
+
operation: ['createSchedule'],
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
description: 'ID da conexão WhatsApp (opcional - usa primeira disponível se não informado)',
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
displayName: 'Mensagem Personalizada',
|
|
345
|
+
name: 'customMessage',
|
|
346
|
+
type: 'string',
|
|
347
|
+
default: '',
|
|
348
|
+
displayOptions: {
|
|
349
|
+
show: {
|
|
350
|
+
operation: ['createSchedule'],
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
description: 'Mensagem personalizada do agendamento (opcional)',
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
displayName: 'Lembretes (minutos)',
|
|
357
|
+
name: 'reminders',
|
|
358
|
+
type: 'string',
|
|
359
|
+
default: '60,240',
|
|
360
|
+
placeholder: '60,240,1440',
|
|
361
|
+
displayOptions: {
|
|
362
|
+
show: {
|
|
363
|
+
operation: ['createSchedule'],
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
description: 'Lembretes em minutos antes do agendamento (separados por vírgula)',
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
displayName: 'Duração do Intervalo (minutos)',
|
|
370
|
+
name: 'intervalDuration',
|
|
371
|
+
type: 'number',
|
|
372
|
+
default: 30,
|
|
373
|
+
displayOptions: {
|
|
374
|
+
show: {
|
|
375
|
+
operation: ['createSchedule'],
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
description: 'Duração do intervalo em minutos',
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
displayName: 'Fechar Ticket',
|
|
382
|
+
name: 'closeTicket',
|
|
383
|
+
type: 'boolean',
|
|
384
|
+
default: false,
|
|
385
|
+
displayOptions: {
|
|
386
|
+
show: {
|
|
387
|
+
operation: ['createSchedule'],
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
description: 'Se deve fechar o ticket após criar agendamento',
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
displayName: 'Data',
|
|
394
|
+
name: 'listScheduleDate',
|
|
395
|
+
type: 'string',
|
|
396
|
+
default: '',
|
|
397
|
+
placeholder: '2025-08-08',
|
|
398
|
+
displayOptions: {
|
|
399
|
+
show: {
|
|
400
|
+
operation: ['listSchedules'],
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
description: 'Data no formato YYYY-MM-DD para listar agendamentos',
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
displayName: 'User ID (Opcional)',
|
|
407
|
+
name: 'listScheduleUserId',
|
|
408
|
+
type: 'number',
|
|
409
|
+
default: 0,
|
|
410
|
+
displayOptions: {
|
|
411
|
+
show: {
|
|
412
|
+
operation: ['listSchedules'],
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
description: 'ID do usuário para filtrar agendamentos (opcional)',
|
|
416
|
+
},
|
|
330
417
|
{
|
|
331
418
|
displayName: 'ID do Agendamento',
|
|
332
419
|
name: 'scheduleId',
|
|
@@ -637,6 +724,16 @@ export class Digitalsac implements INodeType {
|
|
|
637
724
|
url = `/typebot/listar_horarios_disponiveis?serviceId=${serviceIdForSlots}&userId=${userIdForSlots}&date=${dateForSlots}`;
|
|
638
725
|
break;
|
|
639
726
|
|
|
727
|
+
case 'listSchedules':
|
|
728
|
+
const dateForList = this.getNodeParameter('listScheduleDate', i) as string;
|
|
729
|
+
const userIdForList = this.getNodeParameter('listScheduleUserId', i) as number;
|
|
730
|
+
|
|
731
|
+
url = `/typebot/listar_agendamentos?date=${dateForList}`;
|
|
732
|
+
if (userIdForList && userIdForList > 0) {
|
|
733
|
+
url += `&userId=${userIdForList}`;
|
|
734
|
+
}
|
|
735
|
+
break;
|
|
736
|
+
|
|
640
737
|
case 'createSchedule':
|
|
641
738
|
url = '/typebot/criar_agendamento';
|
|
642
739
|
method = 'POST';
|
|
@@ -648,6 +745,14 @@ export class Digitalsac implements INodeType {
|
|
|
648
745
|
const contactNameForCreate = this.getNodeParameter('contactName', i) as string;
|
|
649
746
|
const contactPhoneForCreate = this.getNodeParameter('contactPhone', i) as string;
|
|
650
747
|
const notesForCreate = this.getNodeParameter('scheduleNotes', i) as string;
|
|
748
|
+
const whatsappIdForCreate = this.getNodeParameter('whatsappId', i) as number;
|
|
749
|
+
const customMessageForCreate = this.getNodeParameter('customMessage', i) as string;
|
|
750
|
+
const remindersForCreate = this.getNodeParameter('reminders', i) as string;
|
|
751
|
+
const intervalDurationForCreate = this.getNodeParameter('intervalDuration', i) as number;
|
|
752
|
+
const closeTicketForCreate = this.getNodeParameter('closeTicket', i) as boolean;
|
|
753
|
+
|
|
754
|
+
// Converter string de lembretes para array
|
|
755
|
+
const remindersArray = remindersForCreate ? remindersForCreate.split(',').map(r => parseInt(r.trim())) : [60, 240];
|
|
651
756
|
|
|
652
757
|
body = {
|
|
653
758
|
serviceId: serviceIdForCreate,
|
|
@@ -656,7 +761,12 @@ export class Digitalsac implements INodeType {
|
|
|
656
761
|
time: timeForCreate,
|
|
657
762
|
contactName: contactNameForCreate,
|
|
658
763
|
contactPhone: contactPhoneForCreate,
|
|
659
|
-
notes: notesForCreate
|
|
764
|
+
notes: notesForCreate,
|
|
765
|
+
whatsappId: whatsappIdForCreate > 0 ? whatsappIdForCreate : undefined,
|
|
766
|
+
message: customMessageForCreate || undefined,
|
|
767
|
+
reminders: remindersArray,
|
|
768
|
+
intervalDuration: intervalDurationForCreate,
|
|
769
|
+
closeTicket: closeTicketForCreate
|
|
660
770
|
};
|
|
661
771
|
|
|
662
772
|
headers['Content-Type'] = 'application/json';
|