@pipefy/pipefy-process-coder 0.1.0 → 0.1.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.
Files changed (162) hide show
  1. package/.agents/skills/ppc-pipefy-flow-authoring/SKILL.md +262 -262
  2. package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-2-danfe-consulta.json +247 -247
  3. package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-2-webhook-retorno-consulta.json +589 -589
  4. package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-4-recebimento-barramento.json +1391 -1391
  5. package/.agents/skills/ppc-pipefy-flow-authoring/examples/02-subflow-2-danfe-retorno.json +623 -623
  6. package/.agents/skills/ppc-pipefy-flow-authoring/examples/02-subflow-4-criacao-operacao.json +636 -636
  7. package/.agents/skills/ppc-pipefy-flow-authoring/examples/03-subflow-4-criacao-titulo.json +3642 -3642
  8. package/.agents/skills/ppc-pipefy-flow-authoring/examples/04-subflow-4-criacao-cedente.json +863 -863
  9. package/.agents/skills/ppc-pipefy-flow-authoring/examples/04-subflow-4-criacao-sacado.json +799 -799
  10. package/.agents/skills/ppc-pipefy-flow-authoring/examples/README.md +42 -42
  11. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-acompanhamento-cobranca.json +581 -581
  12. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-nfe-monitoramento.json +503 -503
  13. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-retorno-bancario.json +562 -562
  14. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-02-subflow-2-retorno-consulta-cedente.json +557 -557
  15. package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-02-subflow-2-retorno-consulta-sacado.json +609 -609
  16. package/.agents/skills/ppc-pipefy-pipe-authoring/SKILL.md +146 -146
  17. package/.agents/skills/ppc-pipefy-process-design/SKILL.md +127 -127
  18. package/.agents/skills/ppc-pipefy-workspace/SKILL.md +91 -91
  19. package/AGENTS.md +476 -456
  20. package/LICENSE +202 -0
  21. package/NOTICE +11 -0
  22. package/README.md +830 -808
  23. package/bin/pipe.js +25 -4
  24. package/dist/apply/adopt.js +128 -0
  25. package/dist/apply/agentops.js +42 -0
  26. package/dist/apply/compile.js +722 -0
  27. package/dist/apply/execute.js +277 -0
  28. package/dist/apply/flowops.js +293 -0
  29. package/dist/apply/idmap.js +233 -0
  30. package/dist/apply/mutations.js +704 -0
  31. package/dist/apply/registry.js +348 -0
  32. package/dist/apply/types.js +18 -0
  33. package/dist/cli/args.js +79 -0
  34. package/dist/cli.js +196 -0
  35. package/dist/codec/flow.js +164 -0
  36. package/dist/codec/pack.js +88 -0
  37. package/dist/codec/roundtrip.js +86 -0
  38. package/dist/codec/unpack.js +181 -0
  39. package/dist/commands/agents.js +145 -0
  40. package/dist/commands/apply.js +982 -0
  41. package/dist/commands/context.js +79 -0
  42. package/dist/commands/create.js +63 -0
  43. package/dist/commands/diff.js +294 -0
  44. package/dist/commands/flows.js +348 -0
  45. package/dist/commands/misc.js +562 -0
  46. package/dist/commands/plan.js +301 -0
  47. package/dist/commands/pull.js +549 -0
  48. package/dist/commands/runs.js +74 -0
  49. package/dist/commands/skills.js +131 -0
  50. package/dist/commands/verify.js +205 -0
  51. package/dist/config.js +125 -0
  52. package/dist/diff/agents.js +80 -0
  53. package/dist/diff/diff.js +983 -0
  54. package/dist/diff/flow.js +258 -0
  55. package/{src/diff/html.ts → dist/diff/html.js} +274 -322
  56. package/dist/diff/render.js +90 -0
  57. package/dist/model/payload.js +84 -0
  58. package/dist/model/tree.js +7 -0
  59. package/dist/model/volatile.js +54 -0
  60. package/dist/pipefy/agents.js +131 -0
  61. package/dist/pipefy/automations.js +155 -0
  62. package/dist/pipefy/capability.js +84 -0
  63. package/dist/pipefy/client.js +204 -0
  64. package/dist/pipefy/discovery.js +148 -0
  65. package/dist/pipefy/internal.js +406 -0
  66. package/dist/pipefy/ipaas.js +269 -0
  67. package/dist/pipefy/reconstruct.js +676 -0
  68. package/dist/pipefy/reference.js +172 -0
  69. package/dist/pipefy/snapshot.js +185 -0
  70. package/dist/pipefy/toolkit.js +174 -0
  71. package/{src → dist}/pipefy/toolkit_bearer.py +60 -14
  72. package/dist/report/integrations.js +165 -0
  73. package/dist/report/run.js +356 -0
  74. package/dist/util/fsx.js +50 -0
  75. package/dist/util/git.js +25 -0
  76. package/dist/util/json.js +56 -0
  77. package/dist/util/log.js +69 -0
  78. package/dist/util/pool.js +42 -0
  79. package/dist/util/slug.js +23 -0
  80. package/dist/util/tui.js +287 -0
  81. package/dist/validate/index.js +86 -0
  82. package/dist/validate/integrity.js +370 -0
  83. package/dist/validate/reference.js +120 -0
  84. package/dist/validate/schema.js +278 -0
  85. package/dist/version.js +18 -0
  86. package/dist/workspace/agents.js +245 -0
  87. package/{src/workspace/docs.ts → dist/workspace/docs.js} +367 -407
  88. package/dist/workspace/flows.js +149 -0
  89. package/dist/workspace/layout.js +146 -0
  90. package/dist/workspace/lock.js +83 -0
  91. package/dist/workspace/read.js +168 -0
  92. package/dist/workspace/reference.js +24 -0
  93. package/dist/workspace/stamp.js +234 -0
  94. package/dist/workspace/write.js +194 -0
  95. package/package.json +38 -35
  96. package/src/apply/adopt.ts +0 -150
  97. package/src/apply/agentops.ts +0 -71
  98. package/src/apply/compile.ts +0 -875
  99. package/src/apply/execute.ts +0 -336
  100. package/src/apply/flowops.ts +0 -399
  101. package/src/apply/idmap.ts +0 -241
  102. package/src/apply/mutations.ts +0 -955
  103. package/src/apply/registry.ts +0 -430
  104. package/src/apply/types.ts +0 -134
  105. package/src/cli/args.ts +0 -88
  106. package/src/cli.ts +0 -211
  107. package/src/codec/flow.ts +0 -199
  108. package/src/codec/pack.ts +0 -103
  109. package/src/codec/roundtrip.ts +0 -94
  110. package/src/codec/unpack.ts +0 -198
  111. package/src/commands/agents.ts +0 -184
  112. package/src/commands/apply.ts +0 -1144
  113. package/src/commands/context.ts +0 -119
  114. package/src/commands/create.ts +0 -79
  115. package/src/commands/diff.ts +0 -314
  116. package/src/commands/flows.ts +0 -414
  117. package/src/commands/misc.ts +0 -644
  118. package/src/commands/plan.ts +0 -331
  119. package/src/commands/pull.ts +0 -567
  120. package/src/commands/runs.ts +0 -83
  121. package/src/commands/skills.ts +0 -137
  122. package/src/commands/verify.ts +0 -253
  123. package/src/config.ts +0 -168
  124. package/src/diff/agents.ts +0 -122
  125. package/src/diff/diff.ts +0 -1130
  126. package/src/diff/flow.ts +0 -318
  127. package/src/diff/render.ts +0 -101
  128. package/src/model/payload.ts +0 -154
  129. package/src/model/tree.ts +0 -99
  130. package/src/model/volatile.ts +0 -55
  131. package/src/pipefy/agents.ts +0 -165
  132. package/src/pipefy/automations.ts +0 -219
  133. package/src/pipefy/capability.ts +0 -119
  134. package/src/pipefy/client.ts +0 -267
  135. package/src/pipefy/discovery.ts +0 -209
  136. package/src/pipefy/internal.ts +0 -380
  137. package/src/pipefy/ipaas.ts +0 -365
  138. package/src/pipefy/reconstruct.ts +0 -775
  139. package/src/pipefy/reference.ts +0 -251
  140. package/src/pipefy/snapshot.ts +0 -245
  141. package/src/pipefy/toolkit.ts +0 -200
  142. package/src/report/integrations.ts +0 -231
  143. package/src/report/run.ts +0 -475
  144. package/src/util/fsx.ts +0 -45
  145. package/src/util/git.ts +0 -32
  146. package/src/util/json.ts +0 -55
  147. package/src/util/log.ts +0 -76
  148. package/src/util/pool.ts +0 -48
  149. package/src/util/slug.ts +0 -26
  150. package/src/util/tui.ts +0 -335
  151. package/src/validate/index.ts +0 -123
  152. package/src/validate/integrity.ts +0 -387
  153. package/src/validate/reference.ts +0 -136
  154. package/src/validate/schema.ts +0 -328
  155. package/src/workspace/agents.ts +0 -290
  156. package/src/workspace/flows.ts +0 -191
  157. package/src/workspace/layout.ts +0 -165
  158. package/src/workspace/lock.ts +0 -148
  159. package/src/workspace/read.ts +0 -165
  160. package/src/workspace/reference.ts +0 -24
  161. package/src/workspace/stamp.ts +0 -301
  162. package/src/workspace/write.ts +0 -225
@@ -1,799 +1,799 @@
1
- {
2
- "name": "✅[PRD][4/4 SUBFLOW][CRIAÇÃO] SACADO",
3
- "type": "SHARED",
4
- "summary": "",
5
- "description": "",
6
- "tags": [],
7
- "blogUrl": "",
8
- "metadata": {
9
- "externalId": "exampleFlowId12aaaaaa"
10
- },
11
- "author": "Integrações Ipaas 000000000",
12
- "categories": [],
13
- "pieces": [
14
- "@activepieces/piece-subflows",
15
- "@activepieces/piece-pipefy",
16
- "@activepieces/piece-date-helper",
17
- "@activepieces/piece-http-oauth2"
18
- ],
19
- "flows": [
20
- {
21
- "displayName": "✅[PRD][4/4 SUBFLOW][CRIAÇÃO] SACADO",
22
- "trigger": {
23
- "name": "trigger",
24
- "valid": true,
25
- "displayName": "Callable Flow",
26
- "nextAction": {
27
- "name": "step_2",
28
- "type": "PIECE",
29
- "valid": true,
30
- "settings": {
31
- "input": {
32
- "auth": "{{connections['exampleConnectionId3']}}",
33
- "pipeId": "200000005",
34
- "fieldId": "idsacado",
35
- "comments": [],
36
- "assignees": [],
37
- "card_info": [
38
- "uuid",
39
- "suid",
40
- "age",
41
- "title",
42
- "comments_count",
43
- "createdAt",
44
- "current_phase_age",
45
- "done",
46
- "due_date",
47
- "emailMessagingAddress",
48
- "expired",
49
- "late",
50
- "started_current_phase_at",
51
- "updated_at",
52
- "url",
53
- "creatorEmail",
54
- "current_phase"
55
- ],
56
- "created_by": [],
57
- "fieldValue": "{{trigger['output']['data']['sacado']['idSacado']}}",
58
- "attachments": [],
59
- "inbox_emails": [
60
- "bcc",
61
- "body",
62
- "cc",
63
- "from",
64
- "fromName",
65
- "id",
66
- "main_to",
67
- "message_id",
68
- "sent_via_automation",
69
- "state",
70
- "subject",
71
- "to",
72
- "updated_at",
73
- "user",
74
- "attachments"
75
- ],
76
- "organizationId": "100000001",
77
- "phases_history": [],
78
- "child_relations": [],
79
- "parent_relations": []
80
- },
81
- "pieceName": "@activepieces/piece-pipefy",
82
- "actionName": "getCardsByFieldValue",
83
- "pieceVersion": "0.2.0",
84
- "propertySettings": {
85
- "pipeId": {
86
- "type": "MANUAL"
87
- },
88
- "fieldId": {
89
- "type": "MANUAL"
90
- },
91
- "fieldValue": {
92
- "type": "MANUAL"
93
- },
94
- "organizationId": {
95
- "type": "MANUAL"
96
- }
97
- },
98
- "errorHandlingOptions": {
99
- "retryOnFailure": {
100
- "value": false
101
- },
102
- "continueOnFailure": {
103
- "value": false
104
- }
105
- }
106
- },
107
- "nextAction": {
108
- "name": "step_11",
109
- "skip": false,
110
- "type": "CODE",
111
- "valid": true,
112
- "settings": {
113
- "input": {
114
- "cards": "{{step_2['output']['data']['cards']}}",
115
- "empresaCodigo": "{{trigger['output']['data']['empresaCodigo']}}"
116
- },
117
- "sampleData": {},
118
- "sourceCode": {
119
- "code": "export const code = async (inputs) => {\n const alvo = String(inputs.empresaCodigo ?? '').trim();\n\n const card = inputs.cards.find(\n c => String(c.fields?.empresacodigo?.value ?? '').trim() === alvo\n );\n\n // Compara datas no fuso de São Paulo (dia útil BR)\n const emSaoPaulo = (data) =>\n new Intl.DateTimeFormat('en-CA', {\n timeZone: 'America/Sao_Paulo',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).format(data); // => \"YYYY-MM-DD\"\n\n let atualizadoHoje = false;\n if (card?.updated_at) {\n const dataAtualizacao = new Date(card.updated_at);\n if (!isNaN(dataAtualizacao)) {\n atualizadoHoje = emSaoPaulo(dataAtualizacao) === emSaoPaulo(new Date());\n }\n }\n\n return {\n cardId: card?.id ?? null,\n encontrado: !!card,\n // Se foi atualizado hoje, não precisa consultar o cedente novamente\n consultarCedente: card ? !atualizadoHoje : true,\n };\n};",
120
- "packageJson": "{}"
121
- },
122
- "errorHandlingOptions": {
123
- "retryOnFailure": {
124
- "value": false
125
- },
126
- "continueOnFailure": {
127
- "value": false
128
- }
129
- }
130
- },
131
- "nextAction": {
132
- "name": "step_17",
133
- "skip": false,
134
- "type": "PIECE",
135
- "valid": true,
136
- "settings": {
137
- "input": {
138
- "timeZone": "America/Sao_Paulo",
139
- "timeFormat": "YYYY-MM-DDTHH:mm:ss"
140
- },
141
- "pieceName": "@activepieces/piece-date-helper",
142
- "actionName": "get_current_date",
143
- "sampleData": {},
144
- "pieceVersion": "0.1.28",
145
- "propertySettings": {
146
- "timeZone": {
147
- "type": "MANUAL"
148
- },
149
- "timeFormat": {
150
- "type": "MANUAL"
151
- }
152
- },
153
- "errorHandlingOptions": {
154
- "retryOnFailure": {
155
- "value": false
156
- },
157
- "continueOnFailure": {
158
- "value": false
159
- }
160
- }
161
- },
162
- "nextAction": {
163
- "name": "step_3",
164
- "skip": false,
165
- "type": "ROUTER",
166
- "valid": true,
167
- "children": [
168
- {
169
- "name": "step_18",
170
- "skip": false,
171
- "type": "PIECE",
172
- "valid": true,
173
- "settings": {
174
- "input": {
175
- "url": "{{variables['PRD_BASE_URL']}}/v1/orderby/consultations/sacados/{{trigger['output']['data']['sacado']['idSacado']}}?codigoEmpresa={{trigger['output']['data']['empresaCodigo']}}&origem={{trigger['output']['data']['origem']}}",
176
- "auth": "{{connections['exampleConnectionId1']}}",
177
- "body": {},
178
- "method": "GET",
179
- "headers": {
180
- "timestamp": "{{step_17['output']['result']}}",
181
- "Content-Type": "application/json",
182
- "correlation-id": "123e4567-e89b-12d3-a456-426614174000"
183
- },
184
- "failsafe": false,
185
- "body_type": "none",
186
- "use_proxy": false,
187
- "queryParams": {},
188
- "proxy_settings": {}
189
- },
190
- "pieceName": "@activepieces/piece-http-oauth2",
191
- "actionName": "send-oauth2-request",
192
- "sampleData": {},
193
- "pieceVersion": "0.2.5",
194
- "propertySettings": {
195
- "url": {
196
- "type": "MANUAL"
197
- },
198
- "body": {
199
- "type": "MANUAL",
200
- "schema": {}
201
- },
202
- "method": {
203
- "type": "MANUAL"
204
- },
205
- "headers": {
206
- "type": "MANUAL"
207
- },
208
- "timeout": {
209
- "type": "MANUAL"
210
- },
211
- "failsafe": {
212
- "type": "MANUAL"
213
- },
214
- "body_type": {
215
- "type": "MANUAL"
216
- },
217
- "use_proxy": {
218
- "type": "MANUAL"
219
- },
220
- "queryParams": {
221
- "type": "MANUAL"
222
- },
223
- "proxy_settings": {
224
- "type": "MANUAL",
225
- "schema": {}
226
- }
227
- },
228
- "errorHandlingOptions": {
229
- "retryOnFailure": {
230
- "value": false
231
- },
232
- "continueOnFailure": {
233
- "value": false
234
- }
235
- }
236
- },
237
- "nextAction": {
238
- "name": "step_15",
239
- "skip": false,
240
- "type": "PIECE",
241
- "valid": true,
242
- "settings": {
243
- "input": {
244
- "mode": "simple",
245
- "response": {
246
- "response": {
247
- "cardId": "{{step_11['output']['cardId']}}"
248
- }
249
- }
250
- },
251
- "pieceName": "@activepieces/piece-subflows",
252
- "actionName": "returnResponse",
253
- "sampleData": {},
254
- "pieceVersion": "0.4.12",
255
- "propertySettings": {
256
- "mode": {
257
- "type": "MANUAL"
258
- },
259
- "response": {
260
- "type": "MANUAL",
261
- "schema": {
262
- "response": {
263
- "type": "OBJECT",
264
- "required": true,
265
- "displayName": "Response"
266
- }
267
- }
268
- }
269
- },
270
- "errorHandlingOptions": {
271
- "retryOnFailure": {
272
- "value": false
273
- },
274
- "continueOnFailure": {
275
- "value": false
276
- }
277
- }
278
- },
279
- "displayName": "Retornar cardId",
280
- "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
281
- },
282
- "displayName": "Consulta Sacado",
283
- "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
284
- },
285
- {
286
- "name": "step_5",
287
- "skip": false,
288
- "type": "PIECE",
289
- "valid": true,
290
- "settings": {
291
- "input": {
292
- "mode": "simple",
293
- "response": {
294
- "response": {
295
- "cardId": "{{step_11['output']['cardId']}}"
296
- }
297
- }
298
- },
299
- "pieceName": "@activepieces/piece-subflows",
300
- "actionName": "returnResponse",
301
- "sampleData": {},
302
- "pieceVersion": "0.4.12",
303
- "propertySettings": {
304
- "mode": {
305
- "type": "MANUAL"
306
- },
307
- "response": {
308
- "type": "MANUAL",
309
- "schema": {
310
- "response": {
311
- "type": "OBJECT",
312
- "required": true,
313
- "displayName": "Response"
314
- }
315
- }
316
- }
317
- },
318
- "errorHandlingOptions": {
319
- "retryOnFailure": {
320
- "value": false
321
- },
322
- "continueOnFailure": {
323
- "value": false
324
- }
325
- }
326
- },
327
- "displayName": "Retornar cardId Copy",
328
- "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
329
- },
330
- {
331
- "name": "step_13",
332
- "skip": false,
333
- "type": "CODE",
334
- "valid": true,
335
- "settings": {
336
- "input": {
337
- "email": "{{trigger['output']['data']['sacado']['email']}}",
338
- "cnpjOuCpf": "{{trigger['output']['data']['sacado']['cnpjOuCpf']}}",
339
- "bodyBarramento ": "{{trigger['output']['data']['sacado']}}",
340
- "telefoneContato ": "{{trigger['output']['data']['sacado']['telefoneContato']}}"
341
- },
342
- "sampleData": {},
343
- "sourceCode": {
344
- "code": "export const code = async (inputs) => {\n // Normaliza chaves removendo espaços extras\n const normalizedInputs = {};\n for (const key in inputs) {\n normalizedInputs[key.trim()] = inputs[key];\n }\n inputs = normalizedInputs;\n\n // ===== Helper para arredondar números com 2 casas decimais =====\n const round2 = (n) => Math.round((Number(n) || 0) * 100) / 100;\n\n // ===== Normaliza telefone =====\n let telefoneContato = '';\n let telefoneContatoFormatado = '';\n if (inputs.telefoneContato) {\n let numeros = String(inputs.telefoneContato).replace(/\\D/g, '');\n // Remove o 55 inicial se já vier com código do país\n if ((numeros.length === 12 || numeros.length === 13) && numeros.startsWith('55')) {\n numeros = numeros.substring(2);\n }\n if (numeros.length === 11) {\n // Celular com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 7);\n const parte2 = numeros.substring(7);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else if (numeros.length === 10) {\n // Fixo com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 6);\n const parte2 = numeros.substring(6);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else {\n telefoneContato = numeros;\n telefoneContatoFormatado = numeros;\n }\n }\n\n // ===== Normaliza e-mails =====\n // Se não houver nenhum '@' no input, devolve o valor original e marca emailCheck = false.\n // Caso contrário, considera apenas e-mails válidos (com @ e domínio com TLD),\n // aceitando separação por ; , espaço ou quebra de linha, e devolve separados por vírgula.\n let email = '';\n let emailCheck = true;\n if (inputs.email) {\n const emailStr = String(inputs.email);\n if (!emailStr.includes('@')) {\n // Nenhum @ encontrado - retorna valor original\n email = emailStr;\n emailCheck = false;\n } else {\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\n const validos = emailStr\n .split(/[;,\\s]+/)\n .map((e) => e.trim())\n .filter((e) => e && emailRegex.test(e));\n // Remove duplicatas mantendo a ordem\n email = Array.from(new Set(validos)).join(', ');\n }\n }\n\n // ===== Identifica e formata CPF/CNPJ =====\n let cpf = '';\n let cnpj = '';\n let tipo = '';\n if (inputs.cnpjOuCpf) {\n const doc = String(inputs.cnpjOuCpf).replace(/\\D/g, '');\n if (doc.length === 11) {\n cpf = `${doc.substring(0, 3)}.${doc.substring(3, 6)}.${doc.substring(6, 9)}-${doc.substring(9)}`;\n tipo = 'cpf';\n } else if (doc.length === 14) {\n cnpj = `${doc.substring(0, 2)}.${doc.substring(2, 5)}.${doc.substring(5, 8)}/${doc.substring(8, 12)}-${doc.substring(12)}`;\n tipo = 'cnpj';\n }\n }\n\n // ===== Helpers de formatação numérica =====\n const formatBRL = (valor) => {\n const num = Number(valor) || 0;\n return num.toLocaleString('pt-BR', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n });\n };\n\n const formatInt = (valor) => {\n const num = Number(valor) || 0;\n return num.toLocaleString('pt-BR');\n };\n\n // Formata número como percentual no padrão pt-BR (ex.: \"12,34%\")\n const formatPerc = (valor) => {\n const num = Number(valor) || 0;\n return (\n num.toLocaleString('pt-BR', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }) + '%'\n );\n };\n\n // Heurística: campos de contagem/código não levam casas decimais\n const isCountField = (key) => {\n const lower = String(key).toLowerCase();\n return (\n lower.endsWith('qtd') ||\n lower.includes('quantidade') ||\n lower.includes('codigo') ||\n lower.includes('numero')\n );\n };\n\n // Labels amigáveis para campos conhecidos\n const labelMap = {\n totalTitulosLiquidados: 'Total de Títulos Liquidados',\n totalTitulosLiquidadosPagoDia: 'Títulos Liquidados Pagos no Dia',\n totalTitulosLiquidadosPagoAtraso: 'Títulos Liquidados Pagos em Atraso',\n totalOpeNaoEfetivadas: 'Operações Não Efetivadas',\n totalTitulosLiquidadosChequeDevolvido: 'Títulos Liquidados com Cheque Devolvido',\n totalTitulosAbertos: 'Total de Títulos em Aberto',\n totalTitulosAbertosVencidos: 'Títulos em Aberto Vencidos',\n totalTitulosAbertosVencer: 'Títulos em Aberto a Vencer',\n totPresente: 'Total Presente',\n totSac: 'Total Sacado',\n totQtd: 'Total Quantidade',\n totNegativa: 'Total Negativa',\n codigoEvento: 'Código do Evento',\n descricao: 'Descrição',\n totalLiquidado: 'Total Liquidado',\n quantidadeTitulos: 'Quantidade de Títulos',\n historicoValorLiquidado: 'Histórico de Valores Liquidados',\n historicoValorAberto: 'Histórico de Valores em Aberto',\n liquidacaoPorEvento: 'Liquidação por Evento',\n percHPre: 'Percentual Histórico - Presente',\n percHNeg: 'Percentual Histórico - Negativo',\n };\n\n const camelToTitle = (str) =>\n String(str)\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (s) => s.toUpperCase())\n .trim();\n\n const getLabel = (key) => labelMap[key] || camelToTitle(key);\n\n // ===== Converte objeto em tabela markdown =====\n // Detecta pares X / XQtd e gera 3 colunas (Indicador | Valor | Quantidade)\n // Caso contrário gera 2 colunas (Campo | Valor)\n const objToMarkdown = (obj) => {\n if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return '';\n const keys = Object.keys(obj);\n if (keys.length === 0) return '';\n\n const temPares = keys.some(\n (k) => !k.endsWith('Qtd') && keys.includes(`${k}Qtd`)\n );\n\n if (temPares) {\n const usados = new Set();\n const linhas = [];\n\n keys.forEach((k) => {\n if (usados.has(k)) return;\n\n if (k.endsWith('Qtd')) {\n // Qtd órfão (sem par valor)\n const baseKey = k.substring(0, k.length - 3);\n if (!keys.includes(baseKey)) {\n linhas.push({\n label: getLabel(baseKey),\n valor: '-',\n qtd: formatInt(obj[k]),\n });\n usados.add(k);\n }\n } else {\n const qtdKey = `${k}Qtd`;\n if (keys.includes(qtdKey)) {\n linhas.push({\n label: getLabel(k),\n valor: formatBRL(obj[k]),\n qtd: formatInt(obj[qtdKey]),\n });\n usados.add(k);\n usados.add(qtdKey);\n } else {\n linhas.push({\n label: getLabel(k),\n valor: formatBRL(obj[k]),\n qtd: '-',\n });\n usados.add(k);\n }\n }\n });\n\n let md = '| Indicador | Valor (R$) | Quantidade |\\n';\n md += '|-----------|-----------:|-----------:|\\n';\n linhas.forEach((l) => {\n md += `| ${l.label} | ${l.valor} | ${l.qtd} |\\n`;\n });\n return md.trim();\n }\n\n // Tabela simples Campo / Valor\n let md = '| Campo | Valor |\\n';\n md += '|-------|------:|\\n';\n keys.forEach((k) => {\n const v = obj[k];\n let formatado;\n if (typeof v === 'number') {\n formatado = isCountField(k) ? formatInt(v) : formatBRL(v);\n } else {\n formatado = v === null || v === undefined ? '' : String(v);\n }\n md += `| ${getLabel(k)} | ${formatado} |\\n`;\n });\n return md.trim();\n };\n\n // ===== Converte array de objetos em tabela markdown =====\n const arrayToMarkdown = (arr) => {\n if (!Array.isArray(arr) || arr.length === 0) return '';\n const itensValidos = arr.filter((i) => i && typeof i === 'object');\n if (itensValidos.length === 0) return '';\n\n const colunas = Array.from(\n itensValidos.reduce((set, item) => {\n Object.keys(item).forEach((k) => set.add(k));\n return set;\n }, new Set())\n );\n\n let md = '| ' + colunas.map(getLabel).join(' | ') + ' |\\n';\n md += '|' + colunas.map(() => '------').join('|') + '|\\n';\n itensValidos.forEach((item) => {\n md +=\n '| ' +\n colunas\n .map((c) => {\n const v = item[c];\n if (v === undefined || v === null) return '';\n if (typeof v === 'number') {\n return isCountField(c) ? formatInt(v) : formatBRL(v);\n }\n return String(v);\n })\n .join(' | ') +\n ' |\\n';\n });\n return md.trim();\n };\n\n // ===== Processa bodyBarramento =====\n const objetosMarkdown = {};\n const partesMarkdown = [];\n\n // Valores calculados de %Hpre e %Hneg (default zerado)\n let percHPre = '0,00%';\n let percHNeg = '0,00%';\n let percHPreNum = 0;\n let percHNegNum = 0;\n\n if (inputs.bodyBarramento && typeof inputs.bodyBarramento === 'object') {\n // Aceita tanto o payload completo (com data.sacado) quanto o objeto direto\n const root =\n (inputs.bodyBarramento.data && inputs.bodyBarramento.data.sacado) ||\n inputs.bodyBarramento;\n\n // ===== Calcula %Hpre e %Hneg =====\n // %Hpre = totPresente / totSac (valor histórico de presente / valor histórico total do sacado)\n if (root.percHPre && typeof root.percHPre === 'object') {\n const totPresente = Number(root.percHPre.totPresente) || 0;\n const totSac = Number(root.percHPre.totSac) || 0;\n const rawHPre = totSac > 0 ? (totPresente / totSac) * 100 : 0;\n percHPreNum = round2(rawHPre);\n percHPre = formatPerc(percHPreNum);\n }\n\n // %Hneg = totNegativa / totSac (valor histórico negativo / valor histórico total do sacado)\n if (root.percHNeg && typeof root.percHNeg === 'object') {\n const totNegativa = Number(root.percHNeg.totNegativa) || 0;\n const totSac = Number(root.percHNeg.totSac) || 0;\n const rawHNeg = totSac > 0 ? (totNegativa / totSac) * 100 : 0;\n percHNegNum = round2(rawHNeg);\n percHNeg = formatPerc(percHNegNum);\n }\n\n // ===== Demais objetos em markdown =====\n for (const key in root) {\n const value = root[key];\n\n // Objeto aninhado com mais de um parâmetro\n if (\n value &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length > 1\n ) {\n const md = objToMarkdown(value);\n if (md) {\n objetosMarkdown[key] = md;\n partesMarkdown.push(`### ${getLabel(key)}\\n\\n${md}`);\n }\n }\n // Array de objetos\n else if (\n Array.isArray(value) &&\n value.length > 0 &&\n typeof value[0] === 'object'\n ) {\n const md = arrayToMarkdown(value);\n if (md) {\n objetosMarkdown[key] = md;\n partesMarkdown.push(`### ${getLabel(key)}\\n\\n${md}`);\n }\n }\n }\n }\n\n const markdownCompleto = partesMarkdown.join('\\n\\n');\n\n return {\n telefoneContato,\n telefoneContatoFormatado,\n email,\n emailCheck,\n tipo,\n cpf,\n cnpj,\n percHPre,\n percHNeg,\n percHPreNum,\n percHNegNum,\n objetosMarkdown,\n markdownCompleto,\n };\n};",
345
- "packageJson": "{}"
346
- },
347
- "errorHandlingOptions": {
348
- "retryOnFailure": {
349
- "value": false
350
- },
351
- "continueOnFailure": {
352
- "value": false
353
- }
354
- }
355
- },
356
- "nextAction": {
357
- "name": "step_10",
358
- "skip": false,
359
- "type": "PIECE",
360
- "valid": true,
361
- "settings": {
362
- "input": {
363
- "url": {
364
- "url": "https://api.pipefy.com/graphql"
365
- },
366
- "auth": "{{connections['exampleConnectionId3']}}",
367
- "body": {
368
- "data": {
369
- "query": "mutation {\n createCard(input: {\n pipe_id: \"200000005\"\n fields_attributes: [\n { field_id: \"idsacado\", field_value: \"{{trigger['output']['data']['sacado']['idSacado']}}\" }\n { field_id: \"empresacodigo\", field_value: \"{{trigger['output']['data']['empresaCodigo']}}\" }\n { field_id: \"base\", field_value: \"{{trigger['output']['data']['origem']}}\" }\n\t\t\t{ field_id: \"card_id_titulo\", field_value: \"{{trigger['output']['data']['cardIdTitulo']}}\" }\n ]\n }) {\n card { id title createdAt }\n }\n}",
370
- "variables": null
371
- }
372
- },
373
- "method": "POST",
374
- "headers": {},
375
- "failsafe": false,
376
- "body_type": "json",
377
- "queryParams": {},
378
- "followRedirects": false,
379
- "response_is_binary": false
380
- },
381
- "pieceName": "@activepieces/piece-pipefy",
382
- "actionName": "custom_api_call",
383
- "sampleData": {},
384
- "pieceVersion": "0.2.0",
385
- "propertySettings": {
386
- "url": {
387
- "type": "MANUAL",
388
- "schema": {
389
- "url": {
390
- "type": "SHORT_TEXT",
391
- "required": true,
392
- "description": "You can either use the full URL or the relative path to the base URL\ni.e https://api.pipefy.com/graphql/resource or /resource",
393
- "displayName": "URL",
394
- "defaultValue": "https://api.pipefy.com/graphql"
395
- }
396
- }
397
- },
398
- "body": {
399
- "type": "MANUAL",
400
- "schema": {
401
- "data": {
402
- "type": "JSON",
403
- "required": true,
404
- "displayName": "JSON Body"
405
- }
406
- }
407
- },
408
- "method": {
409
- "type": "MANUAL"
410
- },
411
- "headers": {
412
- "type": "MANUAL"
413
- },
414
- "timeout": {
415
- "type": "MANUAL"
416
- },
417
- "failsafe": {
418
- "type": "MANUAL"
419
- },
420
- "body_type": {
421
- "type": "MANUAL"
422
- },
423
- "queryParams": {
424
- "type": "MANUAL"
425
- },
426
- "followRedirects": {
427
- "type": "MANUAL"
428
- },
429
- "response_is_binary": {
430
- "type": "MANUAL"
431
- }
432
- },
433
- "errorHandlingOptions": {
434
- "retryOnFailure": {
435
- "value": false
436
- },
437
- "continueOnFailure": {
438
- "value": false
439
- }
440
- }
441
- },
442
- "nextAction": {
443
- "name": "step_1",
444
- "skip": false,
445
- "type": "PIECE",
446
- "valid": true,
447
- "settings": {
448
- "input": {
449
- "url": {
450
- "url": "https://api.pipefy.com/graphql"
451
- },
452
- "auth": "{{connections['exampleConnectionId3']}}",
453
- "body": {
454
- "data": {
455
- "query": "mutation {\n updateCardField(\n input: {card_id: \"{{step_4['output']['data']['createCard']['card']['id']}}\", field_id:\"telefone_de_contato\",new_value:\"{{step_13['output']['telefoneContatoFormatado']}}\"}\n ) {\n clientMutationId\n }\n}\n",
456
- "variables": null
457
- }
458
- },
459
- "method": "POST",
460
- "headers": {},
461
- "failsafe": false,
462
- "body_type": "json",
463
- "queryParams": {},
464
- "followRedirects": false,
465
- "response_is_binary": false
466
- },
467
- "pieceName": "@activepieces/piece-pipefy",
468
- "actionName": "custom_api_call",
469
- "sampleData": {},
470
- "pieceVersion": "0.1.7",
471
- "propertySettings": {
472
- "url": {
473
- "type": "MANUAL",
474
- "schema": {
475
- "url": {
476
- "type": "SHORT_TEXT",
477
- "required": true,
478
- "description": "You can either use the full URL or the relative path to the base URL\ni.e https://api.pipefy.com/graphql/resource or /resource",
479
- "displayName": "URL",
480
- "defaultValue": "https://api.pipefy.com/graphql"
481
- }
482
- }
483
- },
484
- "body": {
485
- "type": "MANUAL",
486
- "schema": {
487
- "data": {
488
- "type": "JSON",
489
- "required": true,
490
- "displayName": "JSON Body"
491
- }
492
- }
493
- },
494
- "method": {
495
- "type": "MANUAL"
496
- },
497
- "headers": {
498
- "type": "MANUAL"
499
- },
500
- "timeout": {
501
- "type": "MANUAL"
502
- },
503
- "failsafe": {
504
- "type": "MANUAL"
505
- },
506
- "body_type": {
507
- "type": "MANUAL"
508
- },
509
- "queryParams": {
510
- "type": "MANUAL"
511
- },
512
- "followRedirects": {
513
- "type": "MANUAL"
514
- },
515
- "response_is_binary": {
516
- "type": "MANUAL"
517
- }
518
- },
519
- "errorHandlingOptions": {
520
- "retryOnFailure": {
521
- "value": false
522
- },
523
- "continueOnFailure": {
524
- "value": false
525
- }
526
- }
527
- },
528
- "nextAction": {
529
- "name": "step_9",
530
- "skip": false,
531
- "type": "PIECE",
532
- "valid": true,
533
- "settings": {
534
- "input": {
535
- "mode": "simple",
536
- "response": {
537
- "response": {
538
- "cardId": "{{step_10['output']['body']['data']['createCard']['card']['id']}}"
539
- }
540
- }
541
- },
542
- "pieceName": "@activepieces/piece-subflows",
543
- "actionName": "returnResponse",
544
- "sampleData": {},
545
- "pieceVersion": "0.4.12",
546
- "propertySettings": {
547
- "mode": {
548
- "type": "MANUAL"
549
- },
550
- "response": {
551
- "type": "MANUAL",
552
- "schema": {
553
- "response": {
554
- "type": "OBJECT",
555
- "required": true,
556
- "displayName": "Response"
557
- }
558
- }
559
- }
560
- },
561
- "errorHandlingOptions": {
562
- "retryOnFailure": {
563
- "value": false
564
- },
565
- "continueOnFailure": {
566
- "value": false
567
- }
568
- }
569
- },
570
- "nextAction": {
571
- "name": "step_16",
572
- "skip": false,
573
- "type": "PIECE",
574
- "valid": true,
575
- "settings": {
576
- "input": {
577
- "url": "{{variables['PRD_BASE_URL']}}/v1/orderby/consultations/sacados/{{trigger['output']['data']['sacado']['idSacado']}}?codigoEmpresa={{trigger['output']['data']['empresaCodigo']}}&origem={{trigger['output']['data']['origem']}}",
578
- "auth": "{{connections['exampleConnectionId1']}}",
579
- "body": {},
580
- "method": "GET",
581
- "headers": {
582
- "timestamp": "{{step_17['output']['result']}}",
583
- "Content-Type": "application/json",
584
- "correlation-id": "123e4567-e89b-12d3-a456-426614174000"
585
- },
586
- "failsafe": false,
587
- "body_type": "none",
588
- "use_proxy": false,
589
- "queryParams": {},
590
- "proxy_settings": {}
591
- },
592
- "pieceName": "@activepieces/piece-http-oauth2",
593
- "actionName": "send-oauth2-request",
594
- "sampleData": {},
595
- "pieceVersion": "0.2.5",
596
- "propertySettings": {
597
- "url": {
598
- "type": "MANUAL"
599
- },
600
- "body": {
601
- "type": "MANUAL",
602
- "schema": {}
603
- },
604
- "method": {
605
- "type": "MANUAL"
606
- },
607
- "headers": {
608
- "type": "MANUAL"
609
- },
610
- "timeout": {
611
- "type": "MANUAL"
612
- },
613
- "failsafe": {
614
- "type": "MANUAL"
615
- },
616
- "body_type": {
617
- "type": "MANUAL"
618
- },
619
- "use_proxy": {
620
- "type": "MANUAL"
621
- },
622
- "queryParams": {
623
- "type": "MANUAL"
624
- },
625
- "proxy_settings": {
626
- "type": "MANUAL",
627
- "schema": {}
628
- }
629
- },
630
- "errorHandlingOptions": {
631
- "retryOnFailure": {
632
- "value": false
633
- },
634
- "continueOnFailure": {
635
- "value": false
636
- }
637
- }
638
- },
639
- "displayName": "Consulta Sacado",
640
- "lastUpdatedDate": "2026-08-26T16:14:32.887Z"
641
- },
642
- "displayName": "Retornar cardId",
643
- "lastUpdatedDate": "2026-08-26T16:14:32.887Z"
644
- },
645
- "displayName": "atualização Telefone",
646
- "lastUpdatedDate": "2026-08-26T16:14:32.887Z"
647
- },
648
- "displayName": "Criar card",
649
- "lastUpdatedDate": "2026-08-26T16:14:40.613Z"
650
- },
651
- "displayName": "Normalização",
652
- "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
653
- }
654
- ],
655
- "settings": {
656
- "branches": [
657
- {
658
- "branchName": "Existe e atualizar",
659
- "branchType": "CONDITION",
660
- "conditions": [
661
- [
662
- {
663
- "operator": "BOOLEAN_IS_TRUE",
664
- "firstValue": "{{step_11['output']['encontrado']}}"
665
- },
666
- {
667
- "operator": "BOOLEAN_IS_TRUE",
668
- "firstValue": "{{step_13['output']['consultarCedente']}}"
669
- }
670
- ]
671
- ]
672
- },
673
- {
674
- "branchName": "Existe e atualizado",
675
- "branchType": "CONDITION",
676
- "conditions": [
677
- [
678
- {
679
- "operator": "BOOLEAN_IS_TRUE",
680
- "firstValue": "{{step_11['output']['encontrado']}}"
681
- },
682
- {
683
- "operator": "BOOLEAN_IS_FALSE",
684
- "firstValue": "{{step_13['output']['consultarCedente']}}"
685
- }
686
- ]
687
- ]
688
- },
689
- {
690
- "branchName": "Otherwise",
691
- "branchType": "FALLBACK"
692
- }
693
- ],
694
- "sampleData": {},
695
- "executionType": "EXECUTE_FIRST_MATCH"
696
- },
697
- "displayName": "Lista Sacado",
698
- "lastUpdatedDate": "2026-08-26T16:14:32.885Z"
699
- },
700
- "displayName": "Get Current Date",
701
- "lastUpdatedDate": "2026-08-26T16:14:32.885Z"
702
- },
703
- "displayName": "Conferência id e codigoEmpresa Copy",
704
- "lastUpdatedDate": "2026-08-26T16:14:32.885Z"
705
- },
706
- "displayName": "Buscar Sacado",
707
- "lastUpdatedDate": "2026-08-26T16:14:32.884Z"
708
- },
709
- "lastUpdatedDate": "2026-08-26T16:14:32.884Z",
710
- "type": "PIECE_TRIGGER",
711
- "settings": {
712
- "sampleData": {},
713
- "propertySettings": {
714
- "mode": {
715
- "type": "MANUAL"
716
- },
717
- "exampleData": {
718
- "type": "MANUAL",
719
- "schema": {
720
- "sampleData": {
721
- "type": "example",
722
- "required": false,
723
- "displayName": "example"
724
- }
725
- }
726
- }
727
- },
728
- "pieceName": "@activepieces/piece-subflows",
729
- "pieceVersion": "0.4.11",
730
- "triggerName": "callableFlow",
731
- "input": {
732
- "mode": "advanced",
733
- "exampleData": {
734
- "sampleData": {
735
- "origem": "example",
736
- "sacado": {
737
- "nome": "example",
738
- "email": "example",
739
- "endereco": "example",
740
- "idSacado": 0,
741
- "percHNeg": {
742
- "totQtd": 0,
743
- "totSac": 0,
744
- "totNegativa": 0
745
- },
746
- "percHPre": {
747
- "totQtd": 0,
748
- "totSac": 0,
749
- "totPresente": 0
750
- },
751
- "cnpjOuCpf": "example",
752
- "idCedente": 0,
753
- "razaoSocial": "example",
754
- "nomeFantasia": "example",
755
- "codigoEmpresa": 0,
756
- "telefoneContato": "example",
757
- "liquidacaoPorEvento": [
758
- {
759
- "descricao": "example",
760
- "codigoEvento": 0,
761
- "totalLiquidado": 0,
762
- "quantidadeTitulos": 0
763
- }
764
- ],
765
- "historicoValorAberto": {
766
- "totalTitulosAbertos": 0,
767
- "totalTitulosAbertosQtd": 0,
768
- "totalTitulosAbertosVencer": 0,
769
- "totalTitulosAbertosVencidos": 0,
770
- "totalTitulosAbertosVencerQtd": 0,
771
- "totalTitulosAbertosVencidosQtd": 0
772
- },
773
- "historicoValorLiquidado": {
774
- "totalOpeNaoEfetivadas": 0,
775
- "totalTitulosLiquidados": 0,
776
- "totalOpeNaoEfetivadasQtd": 0,
777
- "totalTitulosLiquidadosQtd": 0,
778
- "totalTitulosLiquidadosPagoDia": 0,
779
- "totalTitulosLiquidadosPagoAtraso": 0,
780
- "totalTitulosLiquidadosPagoDiaQtd": 0,
781
- "totalTitulosLiquidadosPagoAtrasoQtd": 0,
782
- "totalTitulosLiquidadosChequeDevolvido": 0,
783
- "totalTitulosLiquidadosChequeDevolvidoQtd": 0
784
- }
785
- },
786
- "cardIdTitulo": "example",
787
- "empresaCodigo": 0
788
- }
789
- }
790
- }
791
- }
792
- },
793
- "valid": true,
794
- "schemaVersion": "22",
795
- "notes": []
796
- }
797
- ],
798
- "status": "PUBLISHED"
799
- }
1
+ {
2
+ "name": "✅[PRD][4/4 SUBFLOW][CRIAÇÃO] SACADO",
3
+ "type": "SHARED",
4
+ "summary": "",
5
+ "description": "",
6
+ "tags": [],
7
+ "blogUrl": "",
8
+ "metadata": {
9
+ "externalId": "exampleFlowId12aaaaaa"
10
+ },
11
+ "author": "Integrações Ipaas 000000000",
12
+ "categories": [],
13
+ "pieces": [
14
+ "@activepieces/piece-subflows",
15
+ "@activepieces/piece-pipefy",
16
+ "@activepieces/piece-date-helper",
17
+ "@activepieces/piece-http-oauth2"
18
+ ],
19
+ "flows": [
20
+ {
21
+ "displayName": "✅[PRD][4/4 SUBFLOW][CRIAÇÃO] SACADO",
22
+ "trigger": {
23
+ "name": "trigger",
24
+ "valid": true,
25
+ "displayName": "Callable Flow",
26
+ "nextAction": {
27
+ "name": "step_2",
28
+ "type": "PIECE",
29
+ "valid": true,
30
+ "settings": {
31
+ "input": {
32
+ "auth": "{{connections['exampleConnectionId3']}}",
33
+ "pipeId": "200000005",
34
+ "fieldId": "idsacado",
35
+ "comments": [],
36
+ "assignees": [],
37
+ "card_info": [
38
+ "uuid",
39
+ "suid",
40
+ "age",
41
+ "title",
42
+ "comments_count",
43
+ "createdAt",
44
+ "current_phase_age",
45
+ "done",
46
+ "due_date",
47
+ "emailMessagingAddress",
48
+ "expired",
49
+ "late",
50
+ "started_current_phase_at",
51
+ "updated_at",
52
+ "url",
53
+ "creatorEmail",
54
+ "current_phase"
55
+ ],
56
+ "created_by": [],
57
+ "fieldValue": "{{trigger['output']['data']['sacado']['idSacado']}}",
58
+ "attachments": [],
59
+ "inbox_emails": [
60
+ "bcc",
61
+ "body",
62
+ "cc",
63
+ "from",
64
+ "fromName",
65
+ "id",
66
+ "main_to",
67
+ "message_id",
68
+ "sent_via_automation",
69
+ "state",
70
+ "subject",
71
+ "to",
72
+ "updated_at",
73
+ "user",
74
+ "attachments"
75
+ ],
76
+ "organizationId": "100000001",
77
+ "phases_history": [],
78
+ "child_relations": [],
79
+ "parent_relations": []
80
+ },
81
+ "pieceName": "@activepieces/piece-pipefy",
82
+ "actionName": "getCardsByFieldValue",
83
+ "pieceVersion": "0.2.0",
84
+ "propertySettings": {
85
+ "pipeId": {
86
+ "type": "MANUAL"
87
+ },
88
+ "fieldId": {
89
+ "type": "MANUAL"
90
+ },
91
+ "fieldValue": {
92
+ "type": "MANUAL"
93
+ },
94
+ "organizationId": {
95
+ "type": "MANUAL"
96
+ }
97
+ },
98
+ "errorHandlingOptions": {
99
+ "retryOnFailure": {
100
+ "value": false
101
+ },
102
+ "continueOnFailure": {
103
+ "value": false
104
+ }
105
+ }
106
+ },
107
+ "nextAction": {
108
+ "name": "step_11",
109
+ "skip": false,
110
+ "type": "CODE",
111
+ "valid": true,
112
+ "settings": {
113
+ "input": {
114
+ "cards": "{{step_2['output']['data']['cards']}}",
115
+ "empresaCodigo": "{{trigger['output']['data']['empresaCodigo']}}"
116
+ },
117
+ "sampleData": {},
118
+ "sourceCode": {
119
+ "code": "export const code = async (inputs) => {\n const alvo = String(inputs.empresaCodigo ?? '').trim();\n\n const card = inputs.cards.find(\n c => String(c.fields?.empresacodigo?.value ?? '').trim() === alvo\n );\n\n // Compara datas no fuso de São Paulo (dia útil BR)\n const emSaoPaulo = (data) =>\n new Intl.DateTimeFormat('en-CA', {\n timeZone: 'America/Sao_Paulo',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }).format(data); // => \"YYYY-MM-DD\"\n\n let atualizadoHoje = false;\n if (card?.updated_at) {\n const dataAtualizacao = new Date(card.updated_at);\n if (!isNaN(dataAtualizacao)) {\n atualizadoHoje = emSaoPaulo(dataAtualizacao) === emSaoPaulo(new Date());\n }\n }\n\n return {\n cardId: card?.id ?? null,\n encontrado: !!card,\n // Se foi atualizado hoje, não precisa consultar o cedente novamente\n consultarCedente: card ? !atualizadoHoje : true,\n };\n};",
120
+ "packageJson": "{}"
121
+ },
122
+ "errorHandlingOptions": {
123
+ "retryOnFailure": {
124
+ "value": false
125
+ },
126
+ "continueOnFailure": {
127
+ "value": false
128
+ }
129
+ }
130
+ },
131
+ "nextAction": {
132
+ "name": "step_17",
133
+ "skip": false,
134
+ "type": "PIECE",
135
+ "valid": true,
136
+ "settings": {
137
+ "input": {
138
+ "timeZone": "America/Sao_Paulo",
139
+ "timeFormat": "YYYY-MM-DDTHH:mm:ss"
140
+ },
141
+ "pieceName": "@activepieces/piece-date-helper",
142
+ "actionName": "get_current_date",
143
+ "sampleData": {},
144
+ "pieceVersion": "0.1.28",
145
+ "propertySettings": {
146
+ "timeZone": {
147
+ "type": "MANUAL"
148
+ },
149
+ "timeFormat": {
150
+ "type": "MANUAL"
151
+ }
152
+ },
153
+ "errorHandlingOptions": {
154
+ "retryOnFailure": {
155
+ "value": false
156
+ },
157
+ "continueOnFailure": {
158
+ "value": false
159
+ }
160
+ }
161
+ },
162
+ "nextAction": {
163
+ "name": "step_3",
164
+ "skip": false,
165
+ "type": "ROUTER",
166
+ "valid": true,
167
+ "children": [
168
+ {
169
+ "name": "step_18",
170
+ "skip": false,
171
+ "type": "PIECE",
172
+ "valid": true,
173
+ "settings": {
174
+ "input": {
175
+ "url": "{{variables['PRD_BASE_URL']}}/v1/orderby/consultations/sacados/{{trigger['output']['data']['sacado']['idSacado']}}?codigoEmpresa={{trigger['output']['data']['empresaCodigo']}}&origem={{trigger['output']['data']['origem']}}",
176
+ "auth": "{{connections['exampleConnectionId1']}}",
177
+ "body": {},
178
+ "method": "GET",
179
+ "headers": {
180
+ "timestamp": "{{step_17['output']['result']}}",
181
+ "Content-Type": "application/json",
182
+ "correlation-id": "123e4567-e89b-12d3-a456-426614174000"
183
+ },
184
+ "failsafe": false,
185
+ "body_type": "none",
186
+ "use_proxy": false,
187
+ "queryParams": {},
188
+ "proxy_settings": {}
189
+ },
190
+ "pieceName": "@activepieces/piece-http-oauth2",
191
+ "actionName": "send-oauth2-request",
192
+ "sampleData": {},
193
+ "pieceVersion": "0.2.5",
194
+ "propertySettings": {
195
+ "url": {
196
+ "type": "MANUAL"
197
+ },
198
+ "body": {
199
+ "type": "MANUAL",
200
+ "schema": {}
201
+ },
202
+ "method": {
203
+ "type": "MANUAL"
204
+ },
205
+ "headers": {
206
+ "type": "MANUAL"
207
+ },
208
+ "timeout": {
209
+ "type": "MANUAL"
210
+ },
211
+ "failsafe": {
212
+ "type": "MANUAL"
213
+ },
214
+ "body_type": {
215
+ "type": "MANUAL"
216
+ },
217
+ "use_proxy": {
218
+ "type": "MANUAL"
219
+ },
220
+ "queryParams": {
221
+ "type": "MANUAL"
222
+ },
223
+ "proxy_settings": {
224
+ "type": "MANUAL",
225
+ "schema": {}
226
+ }
227
+ },
228
+ "errorHandlingOptions": {
229
+ "retryOnFailure": {
230
+ "value": false
231
+ },
232
+ "continueOnFailure": {
233
+ "value": false
234
+ }
235
+ }
236
+ },
237
+ "nextAction": {
238
+ "name": "step_15",
239
+ "skip": false,
240
+ "type": "PIECE",
241
+ "valid": true,
242
+ "settings": {
243
+ "input": {
244
+ "mode": "simple",
245
+ "response": {
246
+ "response": {
247
+ "cardId": "{{step_11['output']['cardId']}}"
248
+ }
249
+ }
250
+ },
251
+ "pieceName": "@activepieces/piece-subflows",
252
+ "actionName": "returnResponse",
253
+ "sampleData": {},
254
+ "pieceVersion": "0.4.12",
255
+ "propertySettings": {
256
+ "mode": {
257
+ "type": "MANUAL"
258
+ },
259
+ "response": {
260
+ "type": "MANUAL",
261
+ "schema": {
262
+ "response": {
263
+ "type": "OBJECT",
264
+ "required": true,
265
+ "displayName": "Response"
266
+ }
267
+ }
268
+ }
269
+ },
270
+ "errorHandlingOptions": {
271
+ "retryOnFailure": {
272
+ "value": false
273
+ },
274
+ "continueOnFailure": {
275
+ "value": false
276
+ }
277
+ }
278
+ },
279
+ "displayName": "Retornar cardId",
280
+ "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
281
+ },
282
+ "displayName": "Consulta Sacado",
283
+ "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
284
+ },
285
+ {
286
+ "name": "step_5",
287
+ "skip": false,
288
+ "type": "PIECE",
289
+ "valid": true,
290
+ "settings": {
291
+ "input": {
292
+ "mode": "simple",
293
+ "response": {
294
+ "response": {
295
+ "cardId": "{{step_11['output']['cardId']}}"
296
+ }
297
+ }
298
+ },
299
+ "pieceName": "@activepieces/piece-subflows",
300
+ "actionName": "returnResponse",
301
+ "sampleData": {},
302
+ "pieceVersion": "0.4.12",
303
+ "propertySettings": {
304
+ "mode": {
305
+ "type": "MANUAL"
306
+ },
307
+ "response": {
308
+ "type": "MANUAL",
309
+ "schema": {
310
+ "response": {
311
+ "type": "OBJECT",
312
+ "required": true,
313
+ "displayName": "Response"
314
+ }
315
+ }
316
+ }
317
+ },
318
+ "errorHandlingOptions": {
319
+ "retryOnFailure": {
320
+ "value": false
321
+ },
322
+ "continueOnFailure": {
323
+ "value": false
324
+ }
325
+ }
326
+ },
327
+ "displayName": "Retornar cardId Copy",
328
+ "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
329
+ },
330
+ {
331
+ "name": "step_13",
332
+ "skip": false,
333
+ "type": "CODE",
334
+ "valid": true,
335
+ "settings": {
336
+ "input": {
337
+ "email": "{{trigger['output']['data']['sacado']['email']}}",
338
+ "cnpjOuCpf": "{{trigger['output']['data']['sacado']['cnpjOuCpf']}}",
339
+ "bodyBarramento ": "{{trigger['output']['data']['sacado']}}",
340
+ "telefoneContato ": "{{trigger['output']['data']['sacado']['telefoneContato']}}"
341
+ },
342
+ "sampleData": {},
343
+ "sourceCode": {
344
+ "code": "export const code = async (inputs) => {\n // Normaliza chaves removendo espaços extras\n const normalizedInputs = {};\n for (const key in inputs) {\n normalizedInputs[key.trim()] = inputs[key];\n }\n inputs = normalizedInputs;\n\n // ===== Helper para arredondar números com 2 casas decimais =====\n const round2 = (n) => Math.round((Number(n) || 0) * 100) / 100;\n\n // ===== Normaliza telefone =====\n let telefoneContato = '';\n let telefoneContatoFormatado = '';\n if (inputs.telefoneContato) {\n let numeros = String(inputs.telefoneContato).replace(/\\D/g, '');\n // Remove o 55 inicial se já vier com código do país\n if ((numeros.length === 12 || numeros.length === 13) && numeros.startsWith('55')) {\n numeros = numeros.substring(2);\n }\n if (numeros.length === 11) {\n // Celular com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 7);\n const parte2 = numeros.substring(7);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else if (numeros.length === 10) {\n // Fixo com DDD\n const ddd = numeros.substring(0, 2);\n const parte1 = numeros.substring(2, 6);\n const parte2 = numeros.substring(6);\n telefoneContato = `55${numeros}`;\n telefoneContatoFormatado = `+55 (${ddd}) ${parte1}-${parte2}`;\n } else {\n telefoneContato = numeros;\n telefoneContatoFormatado = numeros;\n }\n }\n\n // ===== Normaliza e-mails =====\n // Se não houver nenhum '@' no input, devolve o valor original e marca emailCheck = false.\n // Caso contrário, considera apenas e-mails válidos (com @ e domínio com TLD),\n // aceitando separação por ; , espaço ou quebra de linha, e devolve separados por vírgula.\n let email = '';\n let emailCheck = true;\n if (inputs.email) {\n const emailStr = String(inputs.email);\n if (!emailStr.includes('@')) {\n // Nenhum @ encontrado - retorna valor original\n email = emailStr;\n emailCheck = false;\n } else {\n const emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$/;\n const validos = emailStr\n .split(/[;,\\s]+/)\n .map((e) => e.trim())\n .filter((e) => e && emailRegex.test(e));\n // Remove duplicatas mantendo a ordem\n email = Array.from(new Set(validos)).join(', ');\n }\n }\n\n // ===== Identifica e formata CPF/CNPJ =====\n let cpf = '';\n let cnpj = '';\n let tipo = '';\n if (inputs.cnpjOuCpf) {\n const doc = String(inputs.cnpjOuCpf).replace(/\\D/g, '');\n if (doc.length === 11) {\n cpf = `${doc.substring(0, 3)}.${doc.substring(3, 6)}.${doc.substring(6, 9)}-${doc.substring(9)}`;\n tipo = 'cpf';\n } else if (doc.length === 14) {\n cnpj = `${doc.substring(0, 2)}.${doc.substring(2, 5)}.${doc.substring(5, 8)}/${doc.substring(8, 12)}-${doc.substring(12)}`;\n tipo = 'cnpj';\n }\n }\n\n // ===== Helpers de formatação numérica =====\n const formatBRL = (valor) => {\n const num = Number(valor) || 0;\n return num.toLocaleString('pt-BR', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n });\n };\n\n const formatInt = (valor) => {\n const num = Number(valor) || 0;\n return num.toLocaleString('pt-BR');\n };\n\n // Formata número como percentual no padrão pt-BR (ex.: \"12,34%\")\n const formatPerc = (valor) => {\n const num = Number(valor) || 0;\n return (\n num.toLocaleString('pt-BR', {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }) + '%'\n );\n };\n\n // Heurística: campos de contagem/código não levam casas decimais\n const isCountField = (key) => {\n const lower = String(key).toLowerCase();\n return (\n lower.endsWith('qtd') ||\n lower.includes('quantidade') ||\n lower.includes('codigo') ||\n lower.includes('numero')\n );\n };\n\n // Labels amigáveis para campos conhecidos\n const labelMap = {\n totalTitulosLiquidados: 'Total de Títulos Liquidados',\n totalTitulosLiquidadosPagoDia: 'Títulos Liquidados Pagos no Dia',\n totalTitulosLiquidadosPagoAtraso: 'Títulos Liquidados Pagos em Atraso',\n totalOpeNaoEfetivadas: 'Operações Não Efetivadas',\n totalTitulosLiquidadosChequeDevolvido: 'Títulos Liquidados com Cheque Devolvido',\n totalTitulosAbertos: 'Total de Títulos em Aberto',\n totalTitulosAbertosVencidos: 'Títulos em Aberto Vencidos',\n totalTitulosAbertosVencer: 'Títulos em Aberto a Vencer',\n totPresente: 'Total Presente',\n totSac: 'Total Sacado',\n totQtd: 'Total Quantidade',\n totNegativa: 'Total Negativa',\n codigoEvento: 'Código do Evento',\n descricao: 'Descrição',\n totalLiquidado: 'Total Liquidado',\n quantidadeTitulos: 'Quantidade de Títulos',\n historicoValorLiquidado: 'Histórico de Valores Liquidados',\n historicoValorAberto: 'Histórico de Valores em Aberto',\n liquidacaoPorEvento: 'Liquidação por Evento',\n percHPre: 'Percentual Histórico - Presente',\n percHNeg: 'Percentual Histórico - Negativo',\n };\n\n const camelToTitle = (str) =>\n String(str)\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (s) => s.toUpperCase())\n .trim();\n\n const getLabel = (key) => labelMap[key] || camelToTitle(key);\n\n // ===== Converte objeto em tabela markdown =====\n // Detecta pares X / XQtd e gera 3 colunas (Indicador | Valor | Quantidade)\n // Caso contrário gera 2 colunas (Campo | Valor)\n const objToMarkdown = (obj) => {\n if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return '';\n const keys = Object.keys(obj);\n if (keys.length === 0) return '';\n\n const temPares = keys.some(\n (k) => !k.endsWith('Qtd') && keys.includes(`${k}Qtd`)\n );\n\n if (temPares) {\n const usados = new Set();\n const linhas = [];\n\n keys.forEach((k) => {\n if (usados.has(k)) return;\n\n if (k.endsWith('Qtd')) {\n // Qtd órfão (sem par valor)\n const baseKey = k.substring(0, k.length - 3);\n if (!keys.includes(baseKey)) {\n linhas.push({\n label: getLabel(baseKey),\n valor: '-',\n qtd: formatInt(obj[k]),\n });\n usados.add(k);\n }\n } else {\n const qtdKey = `${k}Qtd`;\n if (keys.includes(qtdKey)) {\n linhas.push({\n label: getLabel(k),\n valor: formatBRL(obj[k]),\n qtd: formatInt(obj[qtdKey]),\n });\n usados.add(k);\n usados.add(qtdKey);\n } else {\n linhas.push({\n label: getLabel(k),\n valor: formatBRL(obj[k]),\n qtd: '-',\n });\n usados.add(k);\n }\n }\n });\n\n let md = '| Indicador | Valor (R$) | Quantidade |\\n';\n md += '|-----------|-----------:|-----------:|\\n';\n linhas.forEach((l) => {\n md += `| ${l.label} | ${l.valor} | ${l.qtd} |\\n`;\n });\n return md.trim();\n }\n\n // Tabela simples Campo / Valor\n let md = '| Campo | Valor |\\n';\n md += '|-------|------:|\\n';\n keys.forEach((k) => {\n const v = obj[k];\n let formatado;\n if (typeof v === 'number') {\n formatado = isCountField(k) ? formatInt(v) : formatBRL(v);\n } else {\n formatado = v === null || v === undefined ? '' : String(v);\n }\n md += `| ${getLabel(k)} | ${formatado} |\\n`;\n });\n return md.trim();\n };\n\n // ===== Converte array de objetos em tabela markdown =====\n const arrayToMarkdown = (arr) => {\n if (!Array.isArray(arr) || arr.length === 0) return '';\n const itensValidos = arr.filter((i) => i && typeof i === 'object');\n if (itensValidos.length === 0) return '';\n\n const colunas = Array.from(\n itensValidos.reduce((set, item) => {\n Object.keys(item).forEach((k) => set.add(k));\n return set;\n }, new Set())\n );\n\n let md = '| ' + colunas.map(getLabel).join(' | ') + ' |\\n';\n md += '|' + colunas.map(() => '------').join('|') + '|\\n';\n itensValidos.forEach((item) => {\n md +=\n '| ' +\n colunas\n .map((c) => {\n const v = item[c];\n if (v === undefined || v === null) return '';\n if (typeof v === 'number') {\n return isCountField(c) ? formatInt(v) : formatBRL(v);\n }\n return String(v);\n })\n .join(' | ') +\n ' |\\n';\n });\n return md.trim();\n };\n\n // ===== Processa bodyBarramento =====\n const objetosMarkdown = {};\n const partesMarkdown = [];\n\n // Valores calculados de %Hpre e %Hneg (default zerado)\n let percHPre = '0,00%';\n let percHNeg = '0,00%';\n let percHPreNum = 0;\n let percHNegNum = 0;\n\n if (inputs.bodyBarramento && typeof inputs.bodyBarramento === 'object') {\n // Aceita tanto o payload completo (com data.sacado) quanto o objeto direto\n const root =\n (inputs.bodyBarramento.data && inputs.bodyBarramento.data.sacado) ||\n inputs.bodyBarramento;\n\n // ===== Calcula %Hpre e %Hneg =====\n // %Hpre = totPresente / totSac (valor histórico de presente / valor histórico total do sacado)\n if (root.percHPre && typeof root.percHPre === 'object') {\n const totPresente = Number(root.percHPre.totPresente) || 0;\n const totSac = Number(root.percHPre.totSac) || 0;\n const rawHPre = totSac > 0 ? (totPresente / totSac) * 100 : 0;\n percHPreNum = round2(rawHPre);\n percHPre = formatPerc(percHPreNum);\n }\n\n // %Hneg = totNegativa / totSac (valor histórico negativo / valor histórico total do sacado)\n if (root.percHNeg && typeof root.percHNeg === 'object') {\n const totNegativa = Number(root.percHNeg.totNegativa) || 0;\n const totSac = Number(root.percHNeg.totSac) || 0;\n const rawHNeg = totSac > 0 ? (totNegativa / totSac) * 100 : 0;\n percHNegNum = round2(rawHNeg);\n percHNeg = formatPerc(percHNegNum);\n }\n\n // ===== Demais objetos em markdown =====\n for (const key in root) {\n const value = root[key];\n\n // Objeto aninhado com mais de um parâmetro\n if (\n value &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length > 1\n ) {\n const md = objToMarkdown(value);\n if (md) {\n objetosMarkdown[key] = md;\n partesMarkdown.push(`### ${getLabel(key)}\\n\\n${md}`);\n }\n }\n // Array de objetos\n else if (\n Array.isArray(value) &&\n value.length > 0 &&\n typeof value[0] === 'object'\n ) {\n const md = arrayToMarkdown(value);\n if (md) {\n objetosMarkdown[key] = md;\n partesMarkdown.push(`### ${getLabel(key)}\\n\\n${md}`);\n }\n }\n }\n }\n\n const markdownCompleto = partesMarkdown.join('\\n\\n');\n\n return {\n telefoneContato,\n telefoneContatoFormatado,\n email,\n emailCheck,\n tipo,\n cpf,\n cnpj,\n percHPre,\n percHNeg,\n percHPreNum,\n percHNegNum,\n objetosMarkdown,\n markdownCompleto,\n };\n};",
345
+ "packageJson": "{}"
346
+ },
347
+ "errorHandlingOptions": {
348
+ "retryOnFailure": {
349
+ "value": false
350
+ },
351
+ "continueOnFailure": {
352
+ "value": false
353
+ }
354
+ }
355
+ },
356
+ "nextAction": {
357
+ "name": "step_10",
358
+ "skip": false,
359
+ "type": "PIECE",
360
+ "valid": true,
361
+ "settings": {
362
+ "input": {
363
+ "url": {
364
+ "url": "https://api.pipefy.com/graphql"
365
+ },
366
+ "auth": "{{connections['exampleConnectionId3']}}",
367
+ "body": {
368
+ "data": {
369
+ "query": "mutation {\n createCard(input: {\n pipe_id: \"200000005\"\n fields_attributes: [\n { field_id: \"idsacado\", field_value: \"{{trigger['output']['data']['sacado']['idSacado']}}\" }\n { field_id: \"empresacodigo\", field_value: \"{{trigger['output']['data']['empresaCodigo']}}\" }\n { field_id: \"base\", field_value: \"{{trigger['output']['data']['origem']}}\" }\n\t\t\t{ field_id: \"card_id_titulo\", field_value: \"{{trigger['output']['data']['cardIdTitulo']}}\" }\n ]\n }) {\n card { id title createdAt }\n }\n}",
370
+ "variables": null
371
+ }
372
+ },
373
+ "method": "POST",
374
+ "headers": {},
375
+ "failsafe": false,
376
+ "body_type": "json",
377
+ "queryParams": {},
378
+ "followRedirects": false,
379
+ "response_is_binary": false
380
+ },
381
+ "pieceName": "@activepieces/piece-pipefy",
382
+ "actionName": "custom_api_call",
383
+ "sampleData": {},
384
+ "pieceVersion": "0.2.0",
385
+ "propertySettings": {
386
+ "url": {
387
+ "type": "MANUAL",
388
+ "schema": {
389
+ "url": {
390
+ "type": "SHORT_TEXT",
391
+ "required": true,
392
+ "description": "You can either use the full URL or the relative path to the base URL\ni.e https://api.pipefy.com/graphql/resource or /resource",
393
+ "displayName": "URL",
394
+ "defaultValue": "https://api.pipefy.com/graphql"
395
+ }
396
+ }
397
+ },
398
+ "body": {
399
+ "type": "MANUAL",
400
+ "schema": {
401
+ "data": {
402
+ "type": "JSON",
403
+ "required": true,
404
+ "displayName": "JSON Body"
405
+ }
406
+ }
407
+ },
408
+ "method": {
409
+ "type": "MANUAL"
410
+ },
411
+ "headers": {
412
+ "type": "MANUAL"
413
+ },
414
+ "timeout": {
415
+ "type": "MANUAL"
416
+ },
417
+ "failsafe": {
418
+ "type": "MANUAL"
419
+ },
420
+ "body_type": {
421
+ "type": "MANUAL"
422
+ },
423
+ "queryParams": {
424
+ "type": "MANUAL"
425
+ },
426
+ "followRedirects": {
427
+ "type": "MANUAL"
428
+ },
429
+ "response_is_binary": {
430
+ "type": "MANUAL"
431
+ }
432
+ },
433
+ "errorHandlingOptions": {
434
+ "retryOnFailure": {
435
+ "value": false
436
+ },
437
+ "continueOnFailure": {
438
+ "value": false
439
+ }
440
+ }
441
+ },
442
+ "nextAction": {
443
+ "name": "step_1",
444
+ "skip": false,
445
+ "type": "PIECE",
446
+ "valid": true,
447
+ "settings": {
448
+ "input": {
449
+ "url": {
450
+ "url": "https://api.pipefy.com/graphql"
451
+ },
452
+ "auth": "{{connections['exampleConnectionId3']}}",
453
+ "body": {
454
+ "data": {
455
+ "query": "mutation {\n updateCardField(\n input: {card_id: \"{{step_4['output']['data']['createCard']['card']['id']}}\", field_id:\"telefone_de_contato\",new_value:\"{{step_13['output']['telefoneContatoFormatado']}}\"}\n ) {\n clientMutationId\n }\n}\n",
456
+ "variables": null
457
+ }
458
+ },
459
+ "method": "POST",
460
+ "headers": {},
461
+ "failsafe": false,
462
+ "body_type": "json",
463
+ "queryParams": {},
464
+ "followRedirects": false,
465
+ "response_is_binary": false
466
+ },
467
+ "pieceName": "@activepieces/piece-pipefy",
468
+ "actionName": "custom_api_call",
469
+ "sampleData": {},
470
+ "pieceVersion": "0.1.7",
471
+ "propertySettings": {
472
+ "url": {
473
+ "type": "MANUAL",
474
+ "schema": {
475
+ "url": {
476
+ "type": "SHORT_TEXT",
477
+ "required": true,
478
+ "description": "You can either use the full URL or the relative path to the base URL\ni.e https://api.pipefy.com/graphql/resource or /resource",
479
+ "displayName": "URL",
480
+ "defaultValue": "https://api.pipefy.com/graphql"
481
+ }
482
+ }
483
+ },
484
+ "body": {
485
+ "type": "MANUAL",
486
+ "schema": {
487
+ "data": {
488
+ "type": "JSON",
489
+ "required": true,
490
+ "displayName": "JSON Body"
491
+ }
492
+ }
493
+ },
494
+ "method": {
495
+ "type": "MANUAL"
496
+ },
497
+ "headers": {
498
+ "type": "MANUAL"
499
+ },
500
+ "timeout": {
501
+ "type": "MANUAL"
502
+ },
503
+ "failsafe": {
504
+ "type": "MANUAL"
505
+ },
506
+ "body_type": {
507
+ "type": "MANUAL"
508
+ },
509
+ "queryParams": {
510
+ "type": "MANUAL"
511
+ },
512
+ "followRedirects": {
513
+ "type": "MANUAL"
514
+ },
515
+ "response_is_binary": {
516
+ "type": "MANUAL"
517
+ }
518
+ },
519
+ "errorHandlingOptions": {
520
+ "retryOnFailure": {
521
+ "value": false
522
+ },
523
+ "continueOnFailure": {
524
+ "value": false
525
+ }
526
+ }
527
+ },
528
+ "nextAction": {
529
+ "name": "step_9",
530
+ "skip": false,
531
+ "type": "PIECE",
532
+ "valid": true,
533
+ "settings": {
534
+ "input": {
535
+ "mode": "simple",
536
+ "response": {
537
+ "response": {
538
+ "cardId": "{{step_10['output']['body']['data']['createCard']['card']['id']}}"
539
+ }
540
+ }
541
+ },
542
+ "pieceName": "@activepieces/piece-subflows",
543
+ "actionName": "returnResponse",
544
+ "sampleData": {},
545
+ "pieceVersion": "0.4.12",
546
+ "propertySettings": {
547
+ "mode": {
548
+ "type": "MANUAL"
549
+ },
550
+ "response": {
551
+ "type": "MANUAL",
552
+ "schema": {
553
+ "response": {
554
+ "type": "OBJECT",
555
+ "required": true,
556
+ "displayName": "Response"
557
+ }
558
+ }
559
+ }
560
+ },
561
+ "errorHandlingOptions": {
562
+ "retryOnFailure": {
563
+ "value": false
564
+ },
565
+ "continueOnFailure": {
566
+ "value": false
567
+ }
568
+ }
569
+ },
570
+ "nextAction": {
571
+ "name": "step_16",
572
+ "skip": false,
573
+ "type": "PIECE",
574
+ "valid": true,
575
+ "settings": {
576
+ "input": {
577
+ "url": "{{variables['PRD_BASE_URL']}}/v1/orderby/consultations/sacados/{{trigger['output']['data']['sacado']['idSacado']}}?codigoEmpresa={{trigger['output']['data']['empresaCodigo']}}&origem={{trigger['output']['data']['origem']}}",
578
+ "auth": "{{connections['exampleConnectionId1']}}",
579
+ "body": {},
580
+ "method": "GET",
581
+ "headers": {
582
+ "timestamp": "{{step_17['output']['result']}}",
583
+ "Content-Type": "application/json",
584
+ "correlation-id": "123e4567-e89b-12d3-a456-426614174000"
585
+ },
586
+ "failsafe": false,
587
+ "body_type": "none",
588
+ "use_proxy": false,
589
+ "queryParams": {},
590
+ "proxy_settings": {}
591
+ },
592
+ "pieceName": "@activepieces/piece-http-oauth2",
593
+ "actionName": "send-oauth2-request",
594
+ "sampleData": {},
595
+ "pieceVersion": "0.2.5",
596
+ "propertySettings": {
597
+ "url": {
598
+ "type": "MANUAL"
599
+ },
600
+ "body": {
601
+ "type": "MANUAL",
602
+ "schema": {}
603
+ },
604
+ "method": {
605
+ "type": "MANUAL"
606
+ },
607
+ "headers": {
608
+ "type": "MANUAL"
609
+ },
610
+ "timeout": {
611
+ "type": "MANUAL"
612
+ },
613
+ "failsafe": {
614
+ "type": "MANUAL"
615
+ },
616
+ "body_type": {
617
+ "type": "MANUAL"
618
+ },
619
+ "use_proxy": {
620
+ "type": "MANUAL"
621
+ },
622
+ "queryParams": {
623
+ "type": "MANUAL"
624
+ },
625
+ "proxy_settings": {
626
+ "type": "MANUAL",
627
+ "schema": {}
628
+ }
629
+ },
630
+ "errorHandlingOptions": {
631
+ "retryOnFailure": {
632
+ "value": false
633
+ },
634
+ "continueOnFailure": {
635
+ "value": false
636
+ }
637
+ }
638
+ },
639
+ "displayName": "Consulta Sacado",
640
+ "lastUpdatedDate": "2026-08-26T16:14:32.887Z"
641
+ },
642
+ "displayName": "Retornar cardId",
643
+ "lastUpdatedDate": "2026-08-26T16:14:32.887Z"
644
+ },
645
+ "displayName": "atualização Telefone",
646
+ "lastUpdatedDate": "2026-08-26T16:14:32.887Z"
647
+ },
648
+ "displayName": "Criar card",
649
+ "lastUpdatedDate": "2026-08-26T16:14:40.613Z"
650
+ },
651
+ "displayName": "Normalização",
652
+ "lastUpdatedDate": "2026-08-26T16:14:32.886Z"
653
+ }
654
+ ],
655
+ "settings": {
656
+ "branches": [
657
+ {
658
+ "branchName": "Existe e atualizar",
659
+ "branchType": "CONDITION",
660
+ "conditions": [
661
+ [
662
+ {
663
+ "operator": "BOOLEAN_IS_TRUE",
664
+ "firstValue": "{{step_11['output']['encontrado']}}"
665
+ },
666
+ {
667
+ "operator": "BOOLEAN_IS_TRUE",
668
+ "firstValue": "{{step_13['output']['consultarCedente']}}"
669
+ }
670
+ ]
671
+ ]
672
+ },
673
+ {
674
+ "branchName": "Existe e atualizado",
675
+ "branchType": "CONDITION",
676
+ "conditions": [
677
+ [
678
+ {
679
+ "operator": "BOOLEAN_IS_TRUE",
680
+ "firstValue": "{{step_11['output']['encontrado']}}"
681
+ },
682
+ {
683
+ "operator": "BOOLEAN_IS_FALSE",
684
+ "firstValue": "{{step_13['output']['consultarCedente']}}"
685
+ }
686
+ ]
687
+ ]
688
+ },
689
+ {
690
+ "branchName": "Otherwise",
691
+ "branchType": "FALLBACK"
692
+ }
693
+ ],
694
+ "sampleData": {},
695
+ "executionType": "EXECUTE_FIRST_MATCH"
696
+ },
697
+ "displayName": "Lista Sacado",
698
+ "lastUpdatedDate": "2026-08-26T16:14:32.885Z"
699
+ },
700
+ "displayName": "Get Current Date",
701
+ "lastUpdatedDate": "2026-08-26T16:14:32.885Z"
702
+ },
703
+ "displayName": "Conferência id e codigoEmpresa Copy",
704
+ "lastUpdatedDate": "2026-08-26T16:14:32.885Z"
705
+ },
706
+ "displayName": "Buscar Sacado",
707
+ "lastUpdatedDate": "2026-08-26T16:14:32.884Z"
708
+ },
709
+ "lastUpdatedDate": "2026-08-26T16:14:32.884Z",
710
+ "type": "PIECE_TRIGGER",
711
+ "settings": {
712
+ "sampleData": {},
713
+ "propertySettings": {
714
+ "mode": {
715
+ "type": "MANUAL"
716
+ },
717
+ "exampleData": {
718
+ "type": "MANUAL",
719
+ "schema": {
720
+ "sampleData": {
721
+ "type": "example",
722
+ "required": false,
723
+ "displayName": "example"
724
+ }
725
+ }
726
+ }
727
+ },
728
+ "pieceName": "@activepieces/piece-subflows",
729
+ "pieceVersion": "0.4.11",
730
+ "triggerName": "callableFlow",
731
+ "input": {
732
+ "mode": "advanced",
733
+ "exampleData": {
734
+ "sampleData": {
735
+ "origem": "example",
736
+ "sacado": {
737
+ "nome": "example",
738
+ "email": "example",
739
+ "endereco": "example",
740
+ "idSacado": 0,
741
+ "percHNeg": {
742
+ "totQtd": 0,
743
+ "totSac": 0,
744
+ "totNegativa": 0
745
+ },
746
+ "percHPre": {
747
+ "totQtd": 0,
748
+ "totSac": 0,
749
+ "totPresente": 0
750
+ },
751
+ "cnpjOuCpf": "example",
752
+ "idCedente": 0,
753
+ "razaoSocial": "example",
754
+ "nomeFantasia": "example",
755
+ "codigoEmpresa": 0,
756
+ "telefoneContato": "example",
757
+ "liquidacaoPorEvento": [
758
+ {
759
+ "descricao": "example",
760
+ "codigoEvento": 0,
761
+ "totalLiquidado": 0,
762
+ "quantidadeTitulos": 0
763
+ }
764
+ ],
765
+ "historicoValorAberto": {
766
+ "totalTitulosAbertos": 0,
767
+ "totalTitulosAbertosQtd": 0,
768
+ "totalTitulosAbertosVencer": 0,
769
+ "totalTitulosAbertosVencidos": 0,
770
+ "totalTitulosAbertosVencerQtd": 0,
771
+ "totalTitulosAbertosVencidosQtd": 0
772
+ },
773
+ "historicoValorLiquidado": {
774
+ "totalOpeNaoEfetivadas": 0,
775
+ "totalTitulosLiquidados": 0,
776
+ "totalOpeNaoEfetivadasQtd": 0,
777
+ "totalTitulosLiquidadosQtd": 0,
778
+ "totalTitulosLiquidadosPagoDia": 0,
779
+ "totalTitulosLiquidadosPagoAtraso": 0,
780
+ "totalTitulosLiquidadosPagoDiaQtd": 0,
781
+ "totalTitulosLiquidadosPagoAtrasoQtd": 0,
782
+ "totalTitulosLiquidadosChequeDevolvido": 0,
783
+ "totalTitulosLiquidadosChequeDevolvidoQtd": 0
784
+ }
785
+ },
786
+ "cardIdTitulo": "example",
787
+ "empresaCodigo": 0
788
+ }
789
+ }
790
+ }
791
+ }
792
+ },
793
+ "valid": true,
794
+ "schemaVersion": "22",
795
+ "notes": []
796
+ }
797
+ ],
798
+ "status": "PUBLISHED"
799
+ }