@zernio/node 0.2.189 → 0.2.191

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.
@@ -4917,6 +4917,53 @@ export type otp_type = 'copy_code' | 'one_tap' | 'zero_tap';
4917
4917
 
4918
4918
  export type WhatsAppTemplateComponent = WhatsAppHeaderComponent | WhatsAppBodyComponent | WhatsAppFooterComponent | WhatsAppButtonsComponent;
4919
4919
 
4920
+ /**
4921
+ * A directed edge between two nodes.
4922
+ */
4923
+ export type WorkflowEdge = {
4924
+ id: string;
4925
+ /**
4926
+ * Source node id
4927
+ */
4928
+ source: string;
4929
+ /**
4930
+ * Target node id
4931
+ */
4932
+ target: string;
4933
+ /**
4934
+ * Selects a branch output of a multi-output node: a condition rule id or 'default'; 'reply' or 'timeout' for wait_for_reply; 'success' or 'error' for webhook. Null = the node's single/default output.
4935
+ *
4936
+ */
4937
+ sourceHandle?: (string) | null;
4938
+ };
4939
+
4940
+ /**
4941
+ * A node in a workflow graph. `config` shape depends on `type`.
4942
+ */
4943
+ export type WorkflowNode = {
4944
+ /**
4945
+ * Stable node id referenced by edges
4946
+ */
4947
+ id: string;
4948
+ type: 'trigger' | 'send_message' | 'wait_for_reply' | 'condition' | 'set_variable' | 'delay' | 'webhook' | 'handoff' | 'end';
4949
+ /**
4950
+ * Type-specific settings. trigger: { keywords:[string], matchType: any|contains|exact|regex, onlyFirstMessage:boolean }. send_message: { messageType: text|template|media|interactive, text, template:{name,language,variableMapping}, media:{mediaType,url,caption}, interactive } (template/interactive are WhatsApp-only). wait_for_reply: { timeoutMinutes:int, saveAs:string }. condition: { rules:[{ id, variable, operator: equals|not_equals|contains|not_contains|starts_with|ends_with|exists|not_exists|matches, value }] }. set_variable: { assignments:[{ name, value }] }. delay: { delayMinutes:int }. webhook: { url, method, headers, bodyTemplate, saveAs }. handoff: { note, assignTo }. String fields support {{variable}} interpolation.
4951
+ *
4952
+ */
4953
+ config?: {
4954
+ [key: string]: unknown;
4955
+ };
4956
+ /**
4957
+ * Canvas coordinates (ignored by the executor; used by the future visual builder).
4958
+ */
4959
+ position?: {
4960
+ x?: number;
4961
+ y?: number;
4962
+ };
4963
+ };
4964
+
4965
+ export type type7 = 'trigger' | 'send_message' | 'wait_for_reply' | 'condition' | 'set_variable' | 'delay' | 'webhook' | 'handoff' | 'end';
4966
+
4920
4967
  /**
4921
4968
  * A single X API operation with its per-call price and the Zernio platform methods that trigger it.
4922
4969
  */
@@ -14511,6 +14558,22 @@ export type GetContactResponse = ({
14511
14558
  tags?: Array<(string)>;
14512
14559
  isSubscribed?: boolean;
14513
14560
  isBlocked?: boolean;
14561
+ /**
14562
+ * Messages sent to the contact, derived live from message history across all linked conversations.
14563
+ */
14564
+ messagesSentCount?: number;
14565
+ /**
14566
+ * Messages received from the contact, derived live from message history across all linked conversations.
14567
+ */
14568
+ messagesReceivedCount?: number;
14569
+ /**
14570
+ * Timestamp of the most recent outgoing message, or null if none.
14571
+ */
14572
+ lastMessageSentAt?: (string) | null;
14573
+ /**
14574
+ * Timestamp of the most recent incoming message, or null if none.
14575
+ */
14576
+ lastMessageReceivedAt?: (string) | null;
14514
14577
  customFields?: {
14515
14578
  [key: string]: unknown;
14516
14579
  };
@@ -14527,6 +14590,10 @@ export type GetContactResponse = ({
14527
14590
  displayIdentifier?: string;
14528
14591
  isSubscribed?: boolean;
14529
14592
  conversationId?: string;
14593
+ /**
14594
+ * Most recent message (either direction) in this channel's conversation, or null if none.
14595
+ */
14596
+ lastActiveAt?: (string) | null;
14530
14597
  createdAt?: string;
14531
14598
  }>;
14532
14599
  });
@@ -15132,6 +15199,275 @@ export type AddBroadcastRecipientsError = ({
15132
15199
  error?: string;
15133
15200
  });
15134
15201
 
15202
+ export type ListWorkflowsData = {
15203
+ query?: {
15204
+ limit?: number;
15205
+ /**
15206
+ * Filter by profile. Omit to list across all profiles
15207
+ */
15208
+ profileId?: string;
15209
+ skip?: number;
15210
+ status?: 'draft' | 'active' | 'paused';
15211
+ };
15212
+ };
15213
+
15214
+ export type ListWorkflowsResponse = ({
15215
+ success?: boolean;
15216
+ workflows?: Array<{
15217
+ id?: string;
15218
+ name?: string;
15219
+ description?: string;
15220
+ platform?: string;
15221
+ accountId?: string;
15222
+ accountName?: string;
15223
+ status?: 'draft' | 'active' | 'paused';
15224
+ nodeCount?: number;
15225
+ totalStarted?: number;
15226
+ totalCompleted?: number;
15227
+ totalExited?: number;
15228
+ createdAt?: string;
15229
+ }>;
15230
+ pagination?: {
15231
+ total?: number;
15232
+ limit?: number;
15233
+ skip?: number;
15234
+ hasMore?: boolean;
15235
+ };
15236
+ });
15237
+
15238
+ export type ListWorkflowsError = ({
15239
+ error?: string;
15240
+ });
15241
+
15242
+ export type CreateWorkflowData = {
15243
+ body: {
15244
+ profileId: string;
15245
+ accountId: string;
15246
+ platform?: 'whatsapp' | 'instagram' | 'facebook' | 'telegram' | 'twitter' | 'bluesky' | 'reddit';
15247
+ name: string;
15248
+ description?: string;
15249
+ nodes?: Array<WorkflowNode>;
15250
+ edges?: Array<WorkflowEdge>;
15251
+ /**
15252
+ * The trigger node id; derived from the single trigger node if omitted
15253
+ */
15254
+ entryNodeId?: string;
15255
+ };
15256
+ };
15257
+
15258
+ export type CreateWorkflowResponse = ({
15259
+ success?: boolean;
15260
+ workflow?: {
15261
+ id?: string;
15262
+ name?: string;
15263
+ description?: string;
15264
+ platform?: string;
15265
+ status?: string;
15266
+ nodeCount?: number;
15267
+ entryNodeId?: string;
15268
+ createdAt?: string;
15269
+ };
15270
+ });
15271
+
15272
+ export type CreateWorkflowError = (unknown | {
15273
+ error?: string;
15274
+ });
15275
+
15276
+ export type GetWorkflowData = {
15277
+ path: {
15278
+ workflowId: string;
15279
+ };
15280
+ };
15281
+
15282
+ export type GetWorkflowResponse = ({
15283
+ success?: boolean;
15284
+ workflow?: {
15285
+ id?: string;
15286
+ name?: string;
15287
+ description?: string;
15288
+ platform?: string;
15289
+ accountId?: string;
15290
+ profileId?: string;
15291
+ status?: 'draft' | 'active' | 'paused';
15292
+ entryNodeId?: string;
15293
+ nodes?: Array<WorkflowNode>;
15294
+ edges?: Array<WorkflowEdge>;
15295
+ totalStarted?: number;
15296
+ totalCompleted?: number;
15297
+ totalExited?: number;
15298
+ createdAt?: string;
15299
+ updatedAt?: string;
15300
+ };
15301
+ });
15302
+
15303
+ export type GetWorkflowError = ({
15304
+ error?: string;
15305
+ });
15306
+
15307
+ export type UpdateWorkflowData = {
15308
+ body?: {
15309
+ name?: string;
15310
+ description?: string;
15311
+ nodes?: Array<WorkflowNode>;
15312
+ edges?: Array<WorkflowEdge>;
15313
+ entryNodeId?: (string) | null;
15314
+ };
15315
+ path: {
15316
+ workflowId: string;
15317
+ };
15318
+ };
15319
+
15320
+ export type UpdateWorkflowResponse = ({
15321
+ success?: boolean;
15322
+ workflow?: {
15323
+ id?: string;
15324
+ name?: string;
15325
+ description?: string;
15326
+ status?: string;
15327
+ entryNodeId?: string;
15328
+ nodeCount?: number;
15329
+ updatedAt?: string;
15330
+ };
15331
+ });
15332
+
15333
+ export type UpdateWorkflowError = (unknown | {
15334
+ error?: string;
15335
+ });
15336
+
15337
+ export type DeleteWorkflowData = {
15338
+ path: {
15339
+ workflowId: string;
15340
+ };
15341
+ };
15342
+
15343
+ export type DeleteWorkflowResponse = (unknown);
15344
+
15345
+ export type DeleteWorkflowError = ({
15346
+ error?: string;
15347
+ });
15348
+
15349
+ export type ActivateWorkflowData = {
15350
+ path: {
15351
+ workflowId: string;
15352
+ };
15353
+ };
15354
+
15355
+ export type ActivateWorkflowResponse = ({
15356
+ success?: boolean;
15357
+ workflow?: {
15358
+ id?: string;
15359
+ status?: string;
15360
+ entryNodeId?: string;
15361
+ };
15362
+ });
15363
+
15364
+ export type ActivateWorkflowError = (unknown | {
15365
+ error?: string;
15366
+ });
15367
+
15368
+ export type PauseWorkflowData = {
15369
+ path: {
15370
+ workflowId: string;
15371
+ };
15372
+ };
15373
+
15374
+ export type PauseWorkflowResponse = ({
15375
+ success?: boolean;
15376
+ workflow?: {
15377
+ id?: string;
15378
+ status?: string;
15379
+ };
15380
+ });
15381
+
15382
+ export type PauseWorkflowError = ({
15383
+ error?: string;
15384
+ });
15385
+
15386
+ export type ListWorkflowExecutionsData = {
15387
+ path: {
15388
+ workflowId: string;
15389
+ };
15390
+ query?: {
15391
+ limit?: number;
15392
+ skip?: number;
15393
+ status?: 'running' | 'waiting' | 'completed' | 'exited' | 'failed';
15394
+ };
15395
+ };
15396
+
15397
+ export type ListWorkflowExecutionsResponse = ({
15398
+ success?: boolean;
15399
+ executions?: Array<{
15400
+ id?: string;
15401
+ status?: 'running' | 'waiting' | 'completed' | 'exited' | 'failed';
15402
+ currentNodeId?: string;
15403
+ waitingFor?: {
15404
+ kind?: 'timer' | 'reply';
15405
+ nodeId?: string;
15406
+ } | null;
15407
+ variables?: {
15408
+ [key: string]: unknown;
15409
+ };
15410
+ platformIdentifier?: string;
15411
+ conversationId?: string;
15412
+ stepCount?: number;
15413
+ lastError?: (string) | null;
15414
+ resumeAt?: (string) | null;
15415
+ createdAt?: string;
15416
+ updatedAt?: string;
15417
+ completedAt?: (string) | null;
15418
+ }>;
15419
+ pagination?: {
15420
+ total?: number;
15421
+ limit?: number;
15422
+ skip?: number;
15423
+ hasMore?: boolean;
15424
+ };
15425
+ });
15426
+
15427
+ export type ListWorkflowExecutionsError = ({
15428
+ error?: string;
15429
+ });
15430
+
15431
+ export type TriggerWorkflowData = {
15432
+ body: {
15433
+ /**
15434
+ * Recipient phone (WhatsApp only)
15435
+ */
15436
+ to?: string;
15437
+ /**
15438
+ * An existing conversation to run in (required for non-WhatsApp workflows)
15439
+ */
15440
+ conversationId?: string;
15441
+ /**
15442
+ * Simulated inbound text
15443
+ */
15444
+ text?: string;
15445
+ };
15446
+ path: {
15447
+ workflowId: string;
15448
+ };
15449
+ };
15450
+
15451
+ export type TriggerWorkflowResponse = ({
15452
+ success?: boolean;
15453
+ execution?: {
15454
+ id?: string;
15455
+ status?: string;
15456
+ currentNodeId?: string;
15457
+ waitingFor?: {
15458
+ [key: string]: unknown;
15459
+ } | null;
15460
+ variables?: {
15461
+ [key: string]: unknown;
15462
+ };
15463
+ conversationId?: string;
15464
+ } | null;
15465
+ });
15466
+
15467
+ export type TriggerWorkflowError = (unknown | {
15468
+ error?: string;
15469
+ });
15470
+
15135
15471
  export type ListSequencesData = {
15136
15472
  query?: {
15137
15473
  limit?: number;