@zernio/node 0.2.188 → 0.2.190

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.
@@ -4836,6 +4836,49 @@ export type WhatsAppHeaderComponent = {
4836
4836
 
4837
4837
  export type format = 'text' | 'image' | 'video' | 'gif' | 'document' | 'location';
4838
4838
 
4839
+ /**
4840
+ * A per-user activation session against the shared WhatsApp sandbox number.
4841
+ * Transitions `pending → active` when the inbound webhook receives a reply
4842
+ * from the matching phone (the reply itself proves ownership).
4843
+ *
4844
+ */
4845
+ export type WhatsAppSandboxSession = {
4846
+ /**
4847
+ * Session id. Use this to revoke via DELETE.
4848
+ */
4849
+ id: string;
4850
+ /**
4851
+ * Digits-only E.164 form (no +, spaces, or dashes).
4852
+ */
4853
+ phoneE164: string;
4854
+ /**
4855
+ * `pending` until the phone replies to the activation template, then
4856
+ * `active`. Expired sessions are pruned by TTL and never appear in
4857
+ * list responses.
4858
+ *
4859
+ */
4860
+ status: 'pending' | 'active';
4861
+ /**
4862
+ * UTC timestamp at which the session becomes invalid. Pending sessions
4863
+ * get a 24h window; activated sessions get 7 days.
4864
+ *
4865
+ */
4866
+ expiresAt: string;
4867
+ /**
4868
+ * When the session transitioned `pending → active`, or null.
4869
+ */
4870
+ activatedAt?: (string) | null;
4871
+ createdAt?: (string) | null;
4872
+ };
4873
+
4874
+ /**
4875
+ * `pending` until the phone replies to the activation template, then
4876
+ * `active`. Expired sessions are pruned by TTL and never appear in
4877
+ * list responses.
4878
+ *
4879
+ */
4880
+ export type status9 = 'pending' | 'active';
4881
+
4839
4882
  export type WhatsAppTemplateButton = {
4840
4883
  type: 'quick_reply' | 'url' | 'phone_number' | 'otp' | 'flow' | 'mpm' | 'catalog';
4841
4884
  text: string;
@@ -4874,6 +4917,53 @@ export type otp_type = 'copy_code' | 'one_tap' | 'zero_tap';
4874
4917
 
4875
4918
  export type WhatsAppTemplateComponent = WhatsAppHeaderComponent | WhatsAppBodyComponent | WhatsAppFooterComponent | WhatsAppButtonsComponent;
4876
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
+
4877
4967
  /**
4878
4968
  * A single X API operation with its per-call price and the Zernio platform methods that trigger it.
4879
4969
  */
@@ -13379,6 +13469,22 @@ export type GetWhatsAppPhoneNumbersResponse = ({
13379
13469
  metaVerificationStatus?: string;
13380
13470
  createdAt?: string;
13381
13471
  }>;
13472
+ /**
13473
+ * The shared WhatsApp sandbox (one Zernio-owned number, all users test
13474
+ * against it). Present when the sandbox is configured; null otherwise.
13475
+ * The `accountId` lets you address the sandbox in compose endpoints.
13476
+ * `template` is the only template a sandbox send is allowed to use.
13477
+ *
13478
+ */
13479
+ sandbox?: {
13480
+ phoneNumber?: string;
13481
+ accountId?: (string) | null;
13482
+ template?: {
13483
+ name?: string;
13484
+ language?: string;
13485
+ };
13486
+ isSandbox?: boolean;
13487
+ } | null;
13382
13488
  });
13383
13489
 
13384
13490
  export type GetWhatsAppPhoneNumbersError = ({
@@ -13465,6 +13571,53 @@ export type ReleaseWhatsAppPhoneNumberError = (unknown | {
13465
13571
  error?: string;
13466
13572
  });
13467
13573
 
13574
+ export type ListWhatsAppSandboxSessionsResponse = ({
13575
+ sessions?: Array<WhatsAppSandboxSession>;
13576
+ /**
13577
+ * The shared sandbox phone number in E.164 form.
13578
+ */
13579
+ sandboxNumber?: (string) | null;
13580
+ });
13581
+
13582
+ export type ListWhatsAppSandboxSessionsError = ({
13583
+ error?: string;
13584
+ } | unknown);
13585
+
13586
+ export type CreateWhatsAppSandboxSessionData = {
13587
+ body: {
13588
+ /**
13589
+ * Recipient phone in international format. Digits, spaces, dashes and a leading `+` are all accepted; the server normalizes to E.164 digits-only.
13590
+ */
13591
+ phone: string;
13592
+ };
13593
+ };
13594
+
13595
+ export type CreateWhatsAppSandboxSessionResponse = ({
13596
+ session?: WhatsAppSandboxSession;
13597
+ sandboxNumber?: string;
13598
+ });
13599
+
13600
+ export type CreateWhatsAppSandboxSessionError = (unknown | {
13601
+ error?: string;
13602
+ });
13603
+
13604
+ export type DeleteWhatsAppSandboxSessionData = {
13605
+ path: {
13606
+ /**
13607
+ * The session id returned by POST /v1/whatsapp/sandbox/sessions.
13608
+ */
13609
+ sessionId: string;
13610
+ };
13611
+ };
13612
+
13613
+ export type DeleteWhatsAppSandboxSessionResponse = ({
13614
+ success?: boolean;
13615
+ });
13616
+
13617
+ export type DeleteWhatsAppSandboxSessionError = (unknown | {
13618
+ error?: string;
13619
+ });
13620
+
13468
13621
  export type ListWhatsAppGroupChatsData = {
13469
13622
  query: {
13470
13623
  /**
@@ -15026,6 +15179,275 @@ export type AddBroadcastRecipientsError = ({
15026
15179
  error?: string;
15027
15180
  });
15028
15181
 
15182
+ export type ListWorkflowsData = {
15183
+ query?: {
15184
+ limit?: number;
15185
+ /**
15186
+ * Filter by profile. Omit to list across all profiles
15187
+ */
15188
+ profileId?: string;
15189
+ skip?: number;
15190
+ status?: 'draft' | 'active' | 'paused';
15191
+ };
15192
+ };
15193
+
15194
+ export type ListWorkflowsResponse = ({
15195
+ success?: boolean;
15196
+ workflows?: Array<{
15197
+ id?: string;
15198
+ name?: string;
15199
+ description?: string;
15200
+ platform?: string;
15201
+ accountId?: string;
15202
+ accountName?: string;
15203
+ status?: 'draft' | 'active' | 'paused';
15204
+ nodeCount?: number;
15205
+ totalStarted?: number;
15206
+ totalCompleted?: number;
15207
+ totalExited?: number;
15208
+ createdAt?: string;
15209
+ }>;
15210
+ pagination?: {
15211
+ total?: number;
15212
+ limit?: number;
15213
+ skip?: number;
15214
+ hasMore?: boolean;
15215
+ };
15216
+ });
15217
+
15218
+ export type ListWorkflowsError = ({
15219
+ error?: string;
15220
+ });
15221
+
15222
+ export type CreateWorkflowData = {
15223
+ body: {
15224
+ profileId: string;
15225
+ accountId: string;
15226
+ platform?: 'whatsapp' | 'instagram' | 'facebook' | 'telegram' | 'twitter' | 'bluesky' | 'reddit';
15227
+ name: string;
15228
+ description?: string;
15229
+ nodes?: Array<WorkflowNode>;
15230
+ edges?: Array<WorkflowEdge>;
15231
+ /**
15232
+ * The trigger node id; derived from the single trigger node if omitted
15233
+ */
15234
+ entryNodeId?: string;
15235
+ };
15236
+ };
15237
+
15238
+ export type CreateWorkflowResponse = ({
15239
+ success?: boolean;
15240
+ workflow?: {
15241
+ id?: string;
15242
+ name?: string;
15243
+ description?: string;
15244
+ platform?: string;
15245
+ status?: string;
15246
+ nodeCount?: number;
15247
+ entryNodeId?: string;
15248
+ createdAt?: string;
15249
+ };
15250
+ });
15251
+
15252
+ export type CreateWorkflowError = (unknown | {
15253
+ error?: string;
15254
+ });
15255
+
15256
+ export type GetWorkflowData = {
15257
+ path: {
15258
+ workflowId: string;
15259
+ };
15260
+ };
15261
+
15262
+ export type GetWorkflowResponse = ({
15263
+ success?: boolean;
15264
+ workflow?: {
15265
+ id?: string;
15266
+ name?: string;
15267
+ description?: string;
15268
+ platform?: string;
15269
+ accountId?: string;
15270
+ profileId?: string;
15271
+ status?: 'draft' | 'active' | 'paused';
15272
+ entryNodeId?: string;
15273
+ nodes?: Array<WorkflowNode>;
15274
+ edges?: Array<WorkflowEdge>;
15275
+ totalStarted?: number;
15276
+ totalCompleted?: number;
15277
+ totalExited?: number;
15278
+ createdAt?: string;
15279
+ updatedAt?: string;
15280
+ };
15281
+ });
15282
+
15283
+ export type GetWorkflowError = ({
15284
+ error?: string;
15285
+ });
15286
+
15287
+ export type UpdateWorkflowData = {
15288
+ body?: {
15289
+ name?: string;
15290
+ description?: string;
15291
+ nodes?: Array<WorkflowNode>;
15292
+ edges?: Array<WorkflowEdge>;
15293
+ entryNodeId?: (string) | null;
15294
+ };
15295
+ path: {
15296
+ workflowId: string;
15297
+ };
15298
+ };
15299
+
15300
+ export type UpdateWorkflowResponse = ({
15301
+ success?: boolean;
15302
+ workflow?: {
15303
+ id?: string;
15304
+ name?: string;
15305
+ description?: string;
15306
+ status?: string;
15307
+ entryNodeId?: string;
15308
+ nodeCount?: number;
15309
+ updatedAt?: string;
15310
+ };
15311
+ });
15312
+
15313
+ export type UpdateWorkflowError = (unknown | {
15314
+ error?: string;
15315
+ });
15316
+
15317
+ export type DeleteWorkflowData = {
15318
+ path: {
15319
+ workflowId: string;
15320
+ };
15321
+ };
15322
+
15323
+ export type DeleteWorkflowResponse = (unknown);
15324
+
15325
+ export type DeleteWorkflowError = ({
15326
+ error?: string;
15327
+ });
15328
+
15329
+ export type ActivateWorkflowData = {
15330
+ path: {
15331
+ workflowId: string;
15332
+ };
15333
+ };
15334
+
15335
+ export type ActivateWorkflowResponse = ({
15336
+ success?: boolean;
15337
+ workflow?: {
15338
+ id?: string;
15339
+ status?: string;
15340
+ entryNodeId?: string;
15341
+ };
15342
+ });
15343
+
15344
+ export type ActivateWorkflowError = (unknown | {
15345
+ error?: string;
15346
+ });
15347
+
15348
+ export type PauseWorkflowData = {
15349
+ path: {
15350
+ workflowId: string;
15351
+ };
15352
+ };
15353
+
15354
+ export type PauseWorkflowResponse = ({
15355
+ success?: boolean;
15356
+ workflow?: {
15357
+ id?: string;
15358
+ status?: string;
15359
+ };
15360
+ });
15361
+
15362
+ export type PauseWorkflowError = ({
15363
+ error?: string;
15364
+ });
15365
+
15366
+ export type ListWorkflowExecutionsData = {
15367
+ path: {
15368
+ workflowId: string;
15369
+ };
15370
+ query?: {
15371
+ limit?: number;
15372
+ skip?: number;
15373
+ status?: 'running' | 'waiting' | 'completed' | 'exited' | 'failed';
15374
+ };
15375
+ };
15376
+
15377
+ export type ListWorkflowExecutionsResponse = ({
15378
+ success?: boolean;
15379
+ executions?: Array<{
15380
+ id?: string;
15381
+ status?: 'running' | 'waiting' | 'completed' | 'exited' | 'failed';
15382
+ currentNodeId?: string;
15383
+ waitingFor?: {
15384
+ kind?: 'timer' | 'reply';
15385
+ nodeId?: string;
15386
+ } | null;
15387
+ variables?: {
15388
+ [key: string]: unknown;
15389
+ };
15390
+ platformIdentifier?: string;
15391
+ conversationId?: string;
15392
+ stepCount?: number;
15393
+ lastError?: (string) | null;
15394
+ resumeAt?: (string) | null;
15395
+ createdAt?: string;
15396
+ updatedAt?: string;
15397
+ completedAt?: (string) | null;
15398
+ }>;
15399
+ pagination?: {
15400
+ total?: number;
15401
+ limit?: number;
15402
+ skip?: number;
15403
+ hasMore?: boolean;
15404
+ };
15405
+ });
15406
+
15407
+ export type ListWorkflowExecutionsError = ({
15408
+ error?: string;
15409
+ });
15410
+
15411
+ export type TriggerWorkflowData = {
15412
+ body: {
15413
+ /**
15414
+ * Recipient phone (WhatsApp only)
15415
+ */
15416
+ to?: string;
15417
+ /**
15418
+ * An existing conversation to run in (required for non-WhatsApp workflows)
15419
+ */
15420
+ conversationId?: string;
15421
+ /**
15422
+ * Simulated inbound text
15423
+ */
15424
+ text?: string;
15425
+ };
15426
+ path: {
15427
+ workflowId: string;
15428
+ };
15429
+ };
15430
+
15431
+ export type TriggerWorkflowResponse = ({
15432
+ success?: boolean;
15433
+ execution?: {
15434
+ id?: string;
15435
+ status?: string;
15436
+ currentNodeId?: string;
15437
+ waitingFor?: {
15438
+ [key: string]: unknown;
15439
+ } | null;
15440
+ variables?: {
15441
+ [key: string]: unknown;
15442
+ };
15443
+ conversationId?: string;
15444
+ } | null;
15445
+ });
15446
+
15447
+ export type TriggerWorkflowError = (unknown | {
15448
+ error?: string;
15449
+ });
15450
+
15029
15451
  export type ListSequencesData = {
15030
15452
  query?: {
15031
15453
  limit?: number;