@automagik/omni 2.260729.3 → 2.260730.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8184,7 +8184,9 @@ var init_types2 = __esm(() => {
8184
8184
  "voice.stream_ended",
8185
8185
  "voice.session_ended",
8186
8186
  "voice.user_joined_channel",
8187
- "voice.user_left_channel"
8187
+ "voice.user_left_channel",
8188
+ "template.status_changed",
8189
+ "channel.alert"
8188
8190
  ];
8189
8191
  });
8190
8192
  // ../core/src/events/envelope.ts
@@ -32227,6 +32229,287 @@ var init_person = __esm(() => {
32227
32229
  });
32228
32230
  });
32229
32231
 
32232
+ // ../core/src/schemas/whatsapp-cloud.ts
32233
+ var MetaTemplateCategorySchema, MetaTemplateStatusSchema, MetaTemplateQualityScoreSchema, MetaTemplateHeaderComponentSchema, MetaTemplateBodyComponentSchema, MetaTemplateFooterComponentSchema, MetaTemplateButtonSchema, MetaTemplateButtonsComponentSchema, WhatsAppTemplateComponentSchema, InboundContextSchema, InboundMediaSchema, MetaInboundTextMessageSchema, MetaInboundMediaMessageSchema, MetaInboundLocationMessageSchema, MetaInboundContactsMessageSchema, MetaInboundReactionMessageSchema, MetaInboundInteractiveMessageSchema, MetaInboundButtonMessageSchema, MetaInboundMessageSchema, MetaWebhookStatusEntrySchema, MetaTemplateStatusUpdateSchema, MetaWebhookValueSchema, MetaWebhookChangeSchema, MetaWebhookEntrySchema, MetaWebhookPayloadSchema, EmbeddedSignupExchangeRequestSchema, EmbeddedSignupExchangeResponseSchema, WhatsAppCloudConnectRequestSchema, WhatsAppFlowSendSchema, WhatsAppCloudRegisterRequestSchema, SendTemplateRequestSchema;
32234
+ var init_whatsapp_cloud = __esm(() => {
32235
+ init_zod();
32236
+ init_common();
32237
+ MetaTemplateCategorySchema = exports_external.enum(["MARKETING", "UTILITY", "AUTHENTICATION"]);
32238
+ MetaTemplateStatusSchema = exports_external.enum(["APPROVED", "PENDING", "REJECTED", "PAUSED", "DELETED"]);
32239
+ MetaTemplateQualityScoreSchema = exports_external.enum(["GREEN", "YELLOW", "RED", "UNKNOWN"]);
32240
+ MetaTemplateHeaderComponentSchema = exports_external.object({
32241
+ type: exports_external.literal("HEADER"),
32242
+ format: exports_external.enum(["TEXT", "IMAGE", "VIDEO", "DOCUMENT", "LOCATION"]),
32243
+ text: exports_external.string().optional(),
32244
+ example: exports_external.object({
32245
+ header_text: exports_external.array(exports_external.string()).optional(),
32246
+ header_handle: exports_external.array(exports_external.string()).optional()
32247
+ }).optional()
32248
+ });
32249
+ MetaTemplateBodyComponentSchema = exports_external.object({
32250
+ type: exports_external.literal("BODY"),
32251
+ text: exports_external.string(),
32252
+ example: exports_external.object({
32253
+ body_text: exports_external.array(exports_external.array(exports_external.string())).optional()
32254
+ }).optional()
32255
+ });
32256
+ MetaTemplateFooterComponentSchema = exports_external.object({
32257
+ type: exports_external.literal("FOOTER"),
32258
+ text: exports_external.string()
32259
+ });
32260
+ MetaTemplateButtonSchema = exports_external.discriminatedUnion("type", [
32261
+ exports_external.object({ type: exports_external.literal("QUICK_REPLY"), text: exports_external.string() }),
32262
+ exports_external.object({
32263
+ type: exports_external.literal("URL"),
32264
+ text: exports_external.string(),
32265
+ url: exports_external.string().url(),
32266
+ example: exports_external.array(exports_external.string()).optional()
32267
+ }),
32268
+ exports_external.object({ type: exports_external.literal("PHONE_NUMBER"), text: exports_external.string(), phone_number: exports_external.string() }),
32269
+ exports_external.object({ type: exports_external.literal("COPY_CODE"), example: exports_external.string() })
32270
+ ]);
32271
+ MetaTemplateButtonsComponentSchema = exports_external.object({
32272
+ type: exports_external.literal("BUTTONS"),
32273
+ buttons: exports_external.array(MetaTemplateButtonSchema).min(1).max(10)
32274
+ });
32275
+ WhatsAppTemplateComponentSchema = exports_external.discriminatedUnion("type", [
32276
+ MetaTemplateHeaderComponentSchema,
32277
+ MetaTemplateBodyComponentSchema,
32278
+ MetaTemplateFooterComponentSchema,
32279
+ MetaTemplateButtonsComponentSchema
32280
+ ]);
32281
+ InboundContextSchema = exports_external.object({
32282
+ id: exports_external.string().optional(),
32283
+ from: exports_external.string().optional(),
32284
+ forwarded: exports_external.boolean().optional(),
32285
+ frequently_forwarded: exports_external.boolean().optional()
32286
+ });
32287
+ InboundMediaSchema = exports_external.object({
32288
+ id: exports_external.string(),
32289
+ mime_type: exports_external.string().optional(),
32290
+ sha256: exports_external.string().optional(),
32291
+ caption: exports_external.string().optional(),
32292
+ filename: exports_external.string().optional(),
32293
+ voice: exports_external.boolean().optional(),
32294
+ file: exports_external.string().optional()
32295
+ });
32296
+ MetaInboundTextMessageSchema = exports_external.object({
32297
+ type: exports_external.literal("text"),
32298
+ from: exports_external.string(),
32299
+ id: exports_external.string(),
32300
+ timestamp: exports_external.string(),
32301
+ text: exports_external.object({ body: exports_external.string() }),
32302
+ context: InboundContextSchema.optional()
32303
+ });
32304
+ MetaInboundMediaMessageSchema = exports_external.object({
32305
+ type: exports_external.enum(["image", "audio", "video", "document", "sticker"]),
32306
+ from: exports_external.string(),
32307
+ id: exports_external.string(),
32308
+ timestamp: exports_external.string(),
32309
+ image: InboundMediaSchema.optional(),
32310
+ audio: InboundMediaSchema.optional(),
32311
+ video: InboundMediaSchema.optional(),
32312
+ document: InboundMediaSchema.optional(),
32313
+ sticker: InboundMediaSchema.optional(),
32314
+ context: InboundContextSchema.optional()
32315
+ });
32316
+ MetaInboundLocationMessageSchema = exports_external.object({
32317
+ type: exports_external.literal("location"),
32318
+ from: exports_external.string(),
32319
+ id: exports_external.string(),
32320
+ timestamp: exports_external.string(),
32321
+ location: exports_external.object({
32322
+ latitude: exports_external.number(),
32323
+ longitude: exports_external.number(),
32324
+ name: exports_external.string().optional(),
32325
+ address: exports_external.string().optional()
32326
+ }),
32327
+ context: InboundContextSchema.optional()
32328
+ });
32329
+ MetaInboundContactsMessageSchema = exports_external.object({
32330
+ type: exports_external.literal("contacts"),
32331
+ from: exports_external.string(),
32332
+ id: exports_external.string(),
32333
+ timestamp: exports_external.string(),
32334
+ contacts: exports_external.array(exports_external.object({
32335
+ name: exports_external.object({ formatted_name: exports_external.string().optional(), first_name: exports_external.string().optional() }).passthrough(),
32336
+ phones: exports_external.array(exports_external.object({ phone: exports_external.string().optional(), wa_id: exports_external.string().optional() }).passthrough()).optional()
32337
+ }).passthrough()),
32338
+ context: InboundContextSchema.optional()
32339
+ });
32340
+ MetaInboundReactionMessageSchema = exports_external.object({
32341
+ type: exports_external.literal("reaction"),
32342
+ from: exports_external.string(),
32343
+ id: exports_external.string(),
32344
+ timestamp: exports_external.string(),
32345
+ reaction: exports_external.object({
32346
+ message_id: exports_external.string(),
32347
+ emoji: exports_external.string()
32348
+ })
32349
+ });
32350
+ MetaInboundInteractiveMessageSchema = exports_external.object({
32351
+ type: exports_external.literal("interactive"),
32352
+ from: exports_external.string(),
32353
+ id: exports_external.string(),
32354
+ timestamp: exports_external.string(),
32355
+ interactive: exports_external.object({
32356
+ type: exports_external.enum(["button_reply", "list_reply", "nfm_reply"]),
32357
+ button_reply: exports_external.object({ id: exports_external.string(), title: exports_external.string() }).optional(),
32358
+ list_reply: exports_external.object({ id: exports_external.string(), title: exports_external.string(), description: exports_external.string().optional() }).optional(),
32359
+ nfm_reply: exports_external.object({ response_json: exports_external.string(), body: exports_external.string().optional(), name: exports_external.string().optional() }).optional()
32360
+ }),
32361
+ context: InboundContextSchema.optional()
32362
+ });
32363
+ MetaInboundButtonMessageSchema = exports_external.object({
32364
+ type: exports_external.literal("button"),
32365
+ from: exports_external.string(),
32366
+ id: exports_external.string(),
32367
+ timestamp: exports_external.string(),
32368
+ button: exports_external.object({ payload: exports_external.string(), text: exports_external.string() }),
32369
+ context: InboundContextSchema.optional()
32370
+ });
32371
+ MetaInboundMessageSchema = exports_external.union([
32372
+ MetaInboundTextMessageSchema,
32373
+ MetaInboundMediaMessageSchema,
32374
+ MetaInboundLocationMessageSchema,
32375
+ MetaInboundContactsMessageSchema,
32376
+ MetaInboundReactionMessageSchema,
32377
+ MetaInboundInteractiveMessageSchema,
32378
+ MetaInboundButtonMessageSchema
32379
+ ]);
32380
+ MetaWebhookStatusEntrySchema = exports_external.object({
32381
+ id: exports_external.string(),
32382
+ status: exports_external.enum(["sent", "delivered", "read", "failed"]),
32383
+ timestamp: exports_external.string(),
32384
+ recipient_id: exports_external.string(),
32385
+ errors: exports_external.array(exports_external.object({
32386
+ code: exports_external.number(),
32387
+ title: exports_external.string(),
32388
+ message: exports_external.string().optional(),
32389
+ error_data: exports_external.object({ details: exports_external.string().optional() }).passthrough().optional()
32390
+ }).passthrough()).optional(),
32391
+ conversation: exports_external.object({
32392
+ id: exports_external.string(),
32393
+ origin: exports_external.object({ type: exports_external.string() }).passthrough().optional()
32394
+ }).passthrough().optional(),
32395
+ pricing: exports_external.object({
32396
+ pricing_model: exports_external.string(),
32397
+ billable: exports_external.boolean(),
32398
+ category: exports_external.string()
32399
+ }).passthrough().optional()
32400
+ });
32401
+ MetaTemplateStatusUpdateSchema = exports_external.object({
32402
+ message_template_id: exports_external.string(),
32403
+ message_template_name: exports_external.string(),
32404
+ message_template_language: exports_external.string(),
32405
+ event: exports_external.enum(["APPROVED", "REJECTED", "FLAGGED", "PAUSED", "DISABLED"]),
32406
+ reason: exports_external.string().optional()
32407
+ });
32408
+ MetaWebhookValueSchema = exports_external.object({
32409
+ messaging_product: exports_external.literal("whatsapp").optional(),
32410
+ metadata: exports_external.object({
32411
+ display_phone_number: exports_external.string(),
32412
+ phone_number_id: exports_external.string()
32413
+ }).optional(),
32414
+ contacts: exports_external.array(exports_external.object({
32415
+ profile: exports_external.object({ name: exports_external.string().optional() }).passthrough().optional(),
32416
+ wa_id: exports_external.string().optional()
32417
+ }).passthrough()).optional(),
32418
+ messages: exports_external.array(MetaInboundMessageSchema).optional(),
32419
+ statuses: exports_external.array(MetaWebhookStatusEntrySchema).optional(),
32420
+ errors: exports_external.array(exports_external.object({
32421
+ code: exports_external.number(),
32422
+ title: exports_external.string(),
32423
+ message: exports_external.string().optional()
32424
+ }).passthrough()).optional()
32425
+ });
32426
+ MetaWebhookChangeSchema = exports_external.object({
32427
+ field: exports_external.string(),
32428
+ value: exports_external.union([MetaWebhookValueSchema, MetaTemplateStatusUpdateSchema, exports_external.record(exports_external.string(), exports_external.unknown())])
32429
+ });
32430
+ MetaWebhookEntrySchema = exports_external.object({
32431
+ id: exports_external.string(),
32432
+ changes: exports_external.array(MetaWebhookChangeSchema),
32433
+ time: exports_external.number().optional()
32434
+ });
32435
+ MetaWebhookPayloadSchema = exports_external.object({
32436
+ object: exports_external.literal("whatsapp_business_account"),
32437
+ entry: exports_external.array(MetaWebhookEntrySchema)
32438
+ });
32439
+ EmbeddedSignupExchangeRequestSchema = exports_external.object({
32440
+ code: exports_external.string().min(1)
32441
+ });
32442
+ EmbeddedSignupExchangeResponseSchema = exports_external.object({
32443
+ exchangeHandle: exports_external.string(),
32444
+ wabaIds: exports_external.array(exports_external.string()),
32445
+ phoneNumbers: exports_external.array(exports_external.object({
32446
+ phone_number_id: exports_external.string(),
32447
+ wabaId: exports_external.string(),
32448
+ display_phone_number: exports_external.string().optional(),
32449
+ verified_name: exports_external.string().optional(),
32450
+ quality_rating: exports_external.string().optional()
32451
+ }))
32452
+ });
32453
+ WhatsAppCloudConnectRequestSchema = exports_external.object({
32454
+ accessToken: exports_external.string().min(1).optional(),
32455
+ exchangeHandle: exports_external.string().min(1).optional(),
32456
+ phoneNumberId: exports_external.string().min(1),
32457
+ wabaId: exports_external.string().min(1),
32458
+ appId: exports_external.string().optional(),
32459
+ businessId: exports_external.string().optional()
32460
+ }).refine((v) => Boolean(v.accessToken) !== Boolean(v.exchangeHandle), {
32461
+ message: "Provide exactly one of `accessToken` (manual flow) or `exchangeHandle` (Embedded Signup flow)",
32462
+ path: ["accessToken"]
32463
+ });
32464
+ WhatsAppFlowSendSchema = exports_external.object({
32465
+ flowId: exports_external.string().min(1).optional(),
32466
+ flowName: exports_external.string().min(1).optional(),
32467
+ cta: exports_external.string().min(1).max(30),
32468
+ bodyText: exports_external.string().min(1).max(1024),
32469
+ headerText: exports_external.string().max(60).optional(),
32470
+ footerText: exports_external.string().max(60).optional(),
32471
+ screen: exports_external.string().optional(),
32472
+ data: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
32473
+ flowToken: exports_external.string().optional(),
32474
+ draft: exports_external.boolean().optional()
32475
+ }).refine((v) => Boolean(v.flowId) !== Boolean(v.flowName), {
32476
+ message: "Provide exactly one of flowId or flowName",
32477
+ path: ["flowId"]
32478
+ });
32479
+ WhatsAppCloudRegisterRequestSchema = exports_external.object({
32480
+ pin: exports_external.string().regex(/^\d{6}$/, "PIN must be exactly 6 digits").optional()
32481
+ });
32482
+ SendTemplateRequestSchema = exports_external.object({
32483
+ to: PhoneSchema,
32484
+ templateName: exports_external.string().min(1),
32485
+ language: exports_external.string().min(2).default("pt_BR"),
32486
+ variables: exports_external.record(exports_external.string(), exports_external.string()).default({}),
32487
+ headerMedia: exports_external.object({
32488
+ type: exports_external.enum(["image", "video", "document"]),
32489
+ url: exports_external.string().url().optional(),
32490
+ handle: exports_external.string().optional()
32491
+ }).optional()
32492
+ });
32493
+ });
32494
+
32495
+ // ../core/src/schemas/hermes.ts
32496
+ var HermesContactSchema, HermesWebhookPayloadSchema;
32497
+ var init_hermes = __esm(() => {
32498
+ init_zod();
32499
+ init_whatsapp_cloud();
32500
+ HermesContactSchema = exports_external.object({
32501
+ profile: exports_external.object({ name: exports_external.string().optional() }).optional(),
32502
+ wa_id: exports_external.string().optional()
32503
+ });
32504
+ HermesWebhookPayloadSchema = exports_external.object({
32505
+ media_id: exports_external.string(),
32506
+ message_type: exports_external.string().optional(),
32507
+ contacts: exports_external.array(HermesContactSchema).optional(),
32508
+ messages: exports_external.array(MetaInboundMessageSchema).optional(),
32509
+ statuses: exports_external.array(MetaWebhookStatusEntrySchema).optional()
32510
+ });
32511
+ });
32512
+
32230
32513
  // ../core/src/schemas/index.ts
32231
32514
  var init_schemas = __esm(() => {
32232
32515
  init_agent2();
@@ -32240,6 +32523,8 @@ var init_schemas = __esm(() => {
32240
32523
  init_instance();
32241
32524
  init_message();
32242
32525
  init_person();
32526
+ init_whatsapp_cloud();
32527
+ init_hermes();
32243
32528
  });
32244
32529
 
32245
32530
  // ../core/src/types/channel.ts
@@ -32253,6 +32538,7 @@ var init_channel = __esm(() => {
32253
32538
  "telegram",
32254
32539
  "a2a",
32255
32540
  "gupshup",
32541
+ "hermes",
32256
32542
  "twilio-whatsapp",
32257
32543
  "internal"
32258
32544
  ];
@@ -32272,6 +32558,9 @@ var init_channel = __esm(() => {
32272
32558
  "live_location",
32273
32559
  "product",
32274
32560
  "pix",
32561
+ "template",
32562
+ "location_request",
32563
+ "flow",
32275
32564
  "edit",
32276
32565
  "delete",
32277
32566
  "unknown"
@@ -32281,6 +32570,14 @@ var init_channel = __esm(() => {
32281
32570
  RULE_TYPES = ["allow", "deny"];
32282
32571
  });
32283
32572
 
32573
+ // ../core/src/types/whatsapp-cloud.ts
32574
+ var META_TEMPLATE_CATEGORIES, META_TEMPLATE_STATUSES, META_TEMPLATE_QUALITY_SCORES;
32575
+ var init_whatsapp_cloud2 = __esm(() => {
32576
+ META_TEMPLATE_CATEGORIES = ["MARKETING", "UTILITY", "AUTHENTICATION"];
32577
+ META_TEMPLATE_STATUSES = ["APPROVED", "PENDING", "REJECTED", "PAUSED", "DELETED"];
32578
+ META_TEMPLATE_QUALITY_SCORES = ["GREEN", "YELLOW", "RED", "UNKNOWN"];
32579
+ });
32580
+
32284
32581
  // ../core/src/types/index.ts
32285
32582
  function ok(value) {
32286
32583
  return { ok: true, value };
@@ -32292,6 +32589,7 @@ var SETTING_VALUE_TYPES;
32292
32589
  var init_types5 = __esm(() => {
32293
32590
  init_channel();
32294
32591
  init_agent();
32592
+ init_whatsapp_cloud2();
32295
32593
  SETTING_VALUE_TYPES = ["string", "integer", "boolean", "json", "secret"];
32296
32594
  });
32297
32595
 
@@ -38364,6 +38662,7 @@ var init_capabilities = __esm(() => {
38364
38662
  MESSAGING_WINDOW_MS = 24 * 60 * 60 * 1000;
38365
38663
  CHANNELS_WITH_MESSAGING_WINDOW = new Set([
38366
38664
  "whatsapp-cloud",
38665
+ "hermes",
38367
38666
  "twilio-whatsapp"
38368
38667
  ]);
38369
38668
  CHANNELS_WITH_TYPING_INDICATOR = new Set([
@@ -66871,6 +67170,10 @@ __export(exports_src, {
66871
67170
  armSequence: () => armSequence,
66872
67171
  appUptime: () => appUptime,
66873
67172
  agentStateKey: () => agentStateKey,
67173
+ WhatsAppTemplateComponentSchema: () => WhatsAppTemplateComponentSchema,
67174
+ WhatsAppFlowSendSchema: () => WhatsAppFlowSendSchema,
67175
+ WhatsAppCloudRegisterRequestSchema: () => WhatsAppCloudRegisterRequestSchema,
67176
+ WhatsAppCloudConnectRequestSchema: () => WhatsAppCloudConnectRequestSchema,
66874
67177
  WebhookAgentProvider: () => WebhookAgentProvider,
66875
67178
  ValidationError: () => ValidationError2,
66876
67179
  UuidSchema: () => UuidSchema,
@@ -66891,6 +67194,7 @@ __export(exports_src, {
66891
67194
  SplitDelayModeSchema: () => SplitDelayModeSchema,
66892
67195
  SettingValueTypeSchema: () => SettingValueTypeSchema,
66893
67196
  SetAgentStateSchema: () => SetAgentStateSchema,
67197
+ SendTemplateRequestSchema: () => SendTemplateRequestSchema,
66894
67198
  SendResultSchema: () => SendResultSchema,
66895
67199
  Scheduler: () => Scheduler,
66896
67200
  STREAM_NAMES: () => STREAM_NAMES,
@@ -66922,7 +67226,32 @@ __export(exports_src, {
66922
67226
  NatsGenieProvider: () => NatsGenieProvider,
66923
67227
  NatsEventBus: () => NatsEventBus,
66924
67228
  MetadataSchema: () => MetadataSchema,
67229
+ MetaWebhookValueSchema: () => MetaWebhookValueSchema,
67230
+ MetaWebhookStatusEntrySchema: () => MetaWebhookStatusEntrySchema,
67231
+ MetaWebhookPayloadSchema: () => MetaWebhookPayloadSchema,
67232
+ MetaWebhookEntrySchema: () => MetaWebhookEntrySchema,
67233
+ MetaWebhookChangeSchema: () => MetaWebhookChangeSchema,
67234
+ MetaTemplateStatusUpdateSchema: () => MetaTemplateStatusUpdateSchema,
67235
+ MetaTemplateStatusSchema: () => MetaTemplateStatusSchema,
67236
+ MetaTemplateQualityScoreSchema: () => MetaTemplateQualityScoreSchema,
67237
+ MetaTemplateHeaderComponentSchema: () => MetaTemplateHeaderComponentSchema,
67238
+ MetaTemplateFooterComponentSchema: () => MetaTemplateFooterComponentSchema,
67239
+ MetaTemplateCategorySchema: () => MetaTemplateCategorySchema,
67240
+ MetaTemplateButtonsComponentSchema: () => MetaTemplateButtonsComponentSchema,
67241
+ MetaTemplateButtonSchema: () => MetaTemplateButtonSchema,
67242
+ MetaTemplateBodyComponentSchema: () => MetaTemplateBodyComponentSchema,
67243
+ MetaInboundTextMessageSchema: () => MetaInboundTextMessageSchema,
67244
+ MetaInboundReactionMessageSchema: () => MetaInboundReactionMessageSchema,
67245
+ MetaInboundMessageSchema: () => MetaInboundMessageSchema,
67246
+ MetaInboundMediaMessageSchema: () => MetaInboundMediaMessageSchema,
67247
+ MetaInboundLocationMessageSchema: () => MetaInboundLocationMessageSchema,
67248
+ MetaInboundInteractiveMessageSchema: () => MetaInboundInteractiveMessageSchema,
67249
+ MetaInboundContactsMessageSchema: () => MetaInboundContactsMessageSchema,
67250
+ MetaInboundButtonMessageSchema: () => MetaInboundButtonMessageSchema,
66925
67251
  MIN_HOOK_PRIORITY: () => MIN_HOOK_PRIORITY,
67252
+ META_TEMPLATE_STATUSES: () => META_TEMPLATE_STATUSES,
67253
+ META_TEMPLATE_QUALITY_SCORES: () => META_TEMPLATE_QUALITY_SCORES,
67254
+ META_TEMPLATE_CATEGORIES: () => META_TEMPLATE_CATEGORIES,
66926
67255
  MESSAGING_WINDOW_MS: () => MESSAGING_WINDOW_MS,
66927
67256
  MAX_HOOK_PRIORITY: () => MAX_HOOK_PRIORITY,
66928
67257
  MAX_HOOKS_PER_INSTANCE: () => MAX_HOOKS_PER_INSTANCE,
@@ -66944,6 +67273,8 @@ __export(exports_src, {
66944
67273
  ID_PREFIXES: () => ID_PREFIXES,
66945
67274
  HookRegistry: () => HookRegistry,
66946
67275
  HookContextSchemas: () => HookContextSchemas,
67276
+ HermesWebhookPayloadSchema: () => HermesWebhookPayloadSchema,
67277
+ HermesContactSchema: () => HermesContactSchema,
66947
67278
  HOOK_EVENTS: () => HOOK_EVENTS,
66948
67279
  GuildConfigOverridesSchema: () => GuildConfigOverridesSchema,
66949
67280
  GuildConfigOverrideSchema: () => GuildConfigOverrideSchema,
@@ -66957,6 +67288,8 @@ __export(exports_src, {
66957
67288
  EventStatusSchema: () => EventStatusSchema,
66958
67289
  EventRegistry: () => EventRegistry,
66959
67290
  EventQuerySchema: () => EventQuerySchema,
67291
+ EmbeddedSignupExchangeResponseSchema: () => EmbeddedSignupExchangeResponseSchema,
67292
+ EmbeddedSignupExchangeRequestSchema: () => EmbeddedSignupExchangeRequestSchema,
66960
67293
  EmailSchema: () => EmailSchema,
66961
67294
  EgressLimitError: () => EgressLimitError,
66962
67295
  EgressBlockedError: () => EgressBlockedError,
@@ -72319,6 +72652,7 @@ var init_pg_core = __esm(() => {
72319
72652
  // ../db/src/schema.ts
72320
72653
  var exports_schema = {};
72321
72654
  __export(exports_schema, {
72655
+ whatsappTemplates: () => whatsappTemplates,
72322
72656
  webhookSources: () => webhookSources,
72323
72657
  turnsRelations: () => turnsRelations,
72324
72658
  turns: () => turns,
@@ -72448,7 +72782,7 @@ __export(exports_schema, {
72448
72782
  accessRules: () => accessRules,
72449
72783
  accessModes: () => accessModes
72450
72784
  });
72451
- var channelTypes, agentTypes, agentSystems, agentEntityTypes, debounceMode, splitDelayMode, supersedeMode, replyFilterMode, agentSessionStrategies, ruleTypes, accessModes, settingValueTypes, apiKeyStatuses, apiKeyProfiles, eventTypes, contentTypes, chatTypes, messageSources, messageTypes, messageStatuses, deliveryStatuses, jobStatuses, providerSchemas, agentProviders, agents, agentRoutes, agentSessions, apiKeys, apiKeyAuditLogs, apiKeysRelations, apiKeyAuditLogsRelations, instances, persons, platformIdentities, conversations, chats, chatParticipants, omniGroups, messages2, omniEvents, handoffLogs, closeContactOutcomes, closeContactLogs, accessRules, globalSettings, settingChangeHistory, batchJobs, syncJobTypes, syncJobs, mediaContent, chatIdMappings, pluginStorage, agentProvidersRelations, agentsRelations, instancesRelations, syncJobsRelations, personsRelations, platformIdentitiesRelations, conversationsRelations, chatsRelations, chatParticipantsRelations, messagesRelations, omniEventsRelations, accessRulesRelations, globalSettingsRelations, settingChangeHistoryRelations, batchJobsRelations, mediaContentRelations, chatIdMappingsRelations, deadLetterStatuses, deadLetterEvents, payloadStorageConfig, payloadStages, eventPayloads, webhookSources, conditionOperators, actionTypes, automationDebounceModes, automations2, automationLogStatuses, automationLogs, consumerOffsets, automationsRelations, automationLogsRelations, triggerLogs, triggerLogsRelations, agentRoutesRelations, agentTaskStatuses, agentTasks, agentTasksRelations, turnStatuses, turnActions, turns, turnsRelations, followUpDisarmReasons, chatFollowUpState, chatFollowUpStateRelations, processedEvents, genieHosts, tenantStatuses, principalTypes, principalStatuses, tenantRoles, membershipStatuses, credentialClasses, authCredentialStatuses, platformApiKeyStatuses, tenants, principals, tenantMemberships, tenantRolePolicies, platformApiKeys, tenantKeyLineage, authCredentials, tenantAuditLogs, platformAuditLogs, platformProviderCatalog, tenantProviderConfig, platformSettings, tenantSettings, platformSettingChangeHistory, tenantSettingChangeHistory, platformPluginStorage, tenantPluginStorage, platformPayloadStorageConfig, tenantPayloadStorageOverrides, tenantMigrationLedger, tenantMigrationLedgerHistory;
72785
+ var channelTypes, agentTypes, agentSystems, agentEntityTypes, debounceMode, splitDelayMode, supersedeMode, replyFilterMode, agentSessionStrategies, ruleTypes, accessModes, settingValueTypes, apiKeyStatuses, apiKeyProfiles, eventTypes, contentTypes, chatTypes, messageSources, messageTypes, messageStatuses, deliveryStatuses, jobStatuses, providerSchemas, agentProviders, agents, agentRoutes, agentSessions, apiKeys, apiKeyAuditLogs, apiKeysRelations, apiKeyAuditLogsRelations, instances, whatsappTemplates, persons, platformIdentities, conversations, chats, chatParticipants, omniGroups, messages2, omniEvents, handoffLogs, closeContactOutcomes, closeContactLogs, accessRules, globalSettings, settingChangeHistory, batchJobs, syncJobTypes, syncJobs, mediaContent, chatIdMappings, pluginStorage, agentProvidersRelations, agentsRelations, instancesRelations, syncJobsRelations, personsRelations, platformIdentitiesRelations, conversationsRelations, chatsRelations, chatParticipantsRelations, messagesRelations, omniEventsRelations, accessRulesRelations, globalSettingsRelations, settingChangeHistoryRelations, batchJobsRelations, mediaContentRelations, chatIdMappingsRelations, deadLetterStatuses, deadLetterEvents, payloadStorageConfig, payloadStages, eventPayloads, webhookSources, conditionOperators, actionTypes, automationDebounceModes, automations2, automationLogStatuses, automationLogs, consumerOffsets, automationsRelations, automationLogsRelations, triggerLogs, triggerLogsRelations, agentRoutesRelations, agentTaskStatuses, agentTasks, agentTasksRelations, turnStatuses, turnActions, turns, turnsRelations, followUpDisarmReasons, chatFollowUpState, chatFollowUpStateRelations, processedEvents, genieHosts, tenantStatuses, principalTypes, principalStatuses, tenantRoles, membershipStatuses, credentialClasses, authCredentialStatuses, platformApiKeyStatuses, tenants, principals, tenantMemberships, tenantRolePolicies, platformApiKeys, tenantKeyLineage, authCredentials, tenantAuditLogs, platformAuditLogs, platformProviderCatalog, tenantProviderConfig, platformSettings, tenantSettings, platformSettingChangeHistory, tenantSettingChangeHistory, platformPluginStorage, tenantPluginStorage, platformPayloadStorageConfig, tenantPayloadStorageOverrides, tenantMigrationLedger, tenantMigrationLedgerHistory;
72452
72786
  var init_schema2 = __esm(() => {
72453
72787
  init_events();
72454
72788
  init_drizzle_orm();
@@ -72461,6 +72795,7 @@ var init_schema2 = __esm(() => {
72461
72795
  "telegram",
72462
72796
  "a2a",
72463
72797
  "gupshup",
72798
+ "hermes",
72464
72799
  "twilio-whatsapp",
72465
72800
  "internal"
72466
72801
  ];
@@ -72748,6 +73083,20 @@ var init_schema2 = __esm(() => {
72748
73083
  twilioStatusCallbackUrl: text("twilio_status_callback_url"),
72749
73084
  twilioWebhookUrl: text("twilio_webhook_url"),
72750
73085
  twilioValidateSignature: boolean("twilio_validate_signature").notNull().default(true),
73086
+ metaPhoneNumberId: varchar("meta_phone_number_id", { length: 64 }),
73087
+ metaWabaId: varchar("meta_waba_id", { length: 64 }),
73088
+ metaAccessToken: text("meta_access_token"),
73089
+ metaAppId: varchar("meta_app_id", { length: 64 }),
73090
+ metaBusinessId: varchar("meta_business_id", { length: 64 }),
73091
+ metaApiVersion: varchar("meta_api_version", { length: 16 }).notNull().default("v25.0"),
73092
+ metaConnectionMethod: varchar("meta_connection_method", { length: 32 }).default("manual"),
73093
+ metaDisplayPhoneNumber: varchar("meta_display_phone_number", { length: 32 }),
73094
+ metaConnectedAt: timestamp("meta_connected_at", { withTimezone: true }),
73095
+ hermesBaseUrl: text("hermes_base_url"),
73096
+ hermesUsername: varchar("hermes_username", { length: 255 }),
73097
+ hermesPassword: text("hermes_password"),
73098
+ hermesMediaId: varchar("hermes_media_id", { length: 64 }),
73099
+ hermesTemplateNamespace: varchar("hermes_template_namespace", { length: 128 }),
72751
73100
  agentId: uuid("agent_id").references(() => agents.id, { onDelete: "set null" }),
72752
73101
  agentTimeout: integer("agent_timeout").notNull().default(600),
72753
73102
  agentStreamMode: boolean("agent_stream_mode").notNull().default(false),
@@ -72828,8 +73177,29 @@ var init_schema2 = __esm(() => {
72828
73177
  isActiveIdx: index("instances_is_active_idx").on(table3.isActive),
72829
73178
  isDefaultIdx: index("instances_is_default_idx").on(table3.isDefault),
72830
73179
  agentIdIdx: index("instances_agent_id_idx").on(table3.agentId),
73180
+ metaPhoneNumberIdx: index("instances_meta_phone_number_idx").on(table3.metaPhoneNumberId),
72831
73181
  chainModeCheck: check("instances_chain_mode_check", sql`${table3.chainMode} IN ('off', 'forward', 'bidirectional')`)
72832
73182
  }));
73183
+ whatsappTemplates = pgTable("whatsapp_templates", {
73184
+ id: uuid("id").primaryKey().defaultRandom(),
73185
+ instanceId: uuid("instance_id").notNull().references(() => instances.id, { onDelete: "cascade" }),
73186
+ metaId: varchar("meta_id", { length: 64 }),
73187
+ wabaId: varchar("waba_id", { length: 64 }).notNull(),
73188
+ name: varchar("name", { length: 255 }).notNull(),
73189
+ language: varchar("language", { length: 16 }).notNull().default("pt_BR"),
73190
+ category: varchar("category", { length: 32 }).notNull(),
73191
+ status: varchar("status", { length: 32 }).notNull().default("PENDING"),
73192
+ components: jsonb("components").$type(),
73193
+ variableMapping: jsonb("variable_mapping").$type(),
73194
+ rejectionReason: text("rejection_reason"),
73195
+ qualityScore: varchar("quality_score", { length: 16 }),
73196
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
73197
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
73198
+ }, (t) => ({
73199
+ instanceIdx: index("idx_wa_tpl_instance").on(t.instanceId),
73200
+ instanceNameLangUnique: uniqueIndex("idx_wa_tpl_instance_name_lang").on(t.instanceId, t.name, t.language),
73201
+ statusIdx: index("idx_wa_tpl_status").on(t.status)
73202
+ }));
72833
73203
  persons = pgTable("persons", {
72834
73204
  id: uuid("id").primaryKey().defaultRandom(),
72835
73205
  displayName: varchar("display_name", { length: 255 }),
@@ -127312,7 +127682,7 @@ import { fileURLToPath } from "url";
127312
127682
  // package.json
127313
127683
  var package_default = {
127314
127684
  name: "@automagik/omni",
127315
- version: "2.260729.3",
127685
+ version: "2.260730.2",
127316
127686
  description: "LLM-optimized CLI for Omni",
127317
127687
  type: "module",
127318
127688
  bin: {
@@ -127350,6 +127720,7 @@ var package_default = {
127350
127720
  },
127351
127721
  dependencies: {
127352
127722
  "@anthropic-ai/claude-agent-sdk": "^0.2.62",
127723
+ "@omni/channel-hermes": "workspace:*",
127353
127724
  "@sentry/bun": "^10.43.0",
127354
127725
  "@snazzah/davey": "^0.1.11",
127355
127726
  chalk: "^5.4.0",
@@ -127373,6 +127744,7 @@ var package_default = {
127373
127744
  "@omni/channel-slack": "workspace:*",
127374
127745
  "@omni/channel-telegram": "workspace:*",
127375
127746
  "@omni/channel-whatsapp": "workspace:*",
127747
+ "@omni/channel-whatsapp-cloud": "workspace:*",
127376
127748
  "@omni/core": "workspace:*",
127377
127749
  "@omni/sdk": "workspace:*",
127378
127750
  "@types/node": "^22.10.3",
@@ -135169,10 +135541,45 @@ function createInstancesCommand() {
135169
135541
  error(`Failed to request pairing code: ${message}`);
135170
135542
  }
135171
135543
  });
135172
- instances.command("connect <id>").description("Connect an instance").option("--force-new-qr", "Force generation of new QR code").option("--token <token>", "Discord bot token (for Discord instances)").option("--twilio-account-sid <sid>", "Twilio Account SID").option("--twilio-auth-token <token>", "Twilio Auth Token").option("--twilio-from <address>", "Twilio WhatsApp sender address (whatsapp:+E164)").option("--twilio-messaging-service-sid <sid>", "Twilio Messaging Service SID").option("--twilio-status-callback-url <url>", "Twilio outbound status callback URL").option("--twilio-webhook-url <url>", "Public Twilio webhook URL for signature validation").option("--twilio-validate-signature", "Validate X-Twilio-Signature on webhooks").option("--no-twilio-validate-signature", "Disable X-Twilio-Signature validation").action(async (rawId, options) => {
135544
+ instances.command("connect <id>").description("Connect an instance").option("--force-new-qr", "Force generation of new QR code").option("--token <token>", "Discord bot token (for Discord instances)").option("--twilio-account-sid <sid>", "Twilio Account SID").option("--twilio-auth-token <token>", "Twilio Auth Token").option("--twilio-from <address>", "Twilio WhatsApp sender address (whatsapp:+E164)").option("--twilio-messaging-service-sid <sid>", "Twilio Messaging Service SID").option("--twilio-status-callback-url <url>", "Twilio outbound status callback URL").option("--twilio-webhook-url <url>", "Public Twilio webhook URL for signature validation").option("--twilio-validate-signature", "Validate X-Twilio-Signature on webhooks").option("--no-twilio-validate-signature", "Disable X-Twilio-Signature validation").option("--access-token <token>", "WhatsApp Cloud (Meta) access token \u2014 pair with --phone-number-id + --waba-id").option("--phone-number-id <id>", "WhatsApp Cloud phone_number_id (Graph API id, not E.164)").option("--waba-id <id>", "WhatsApp Business Account id (WABA id)").option("--meta-app-id <id>", "Optional override for META_APP_ID (when the tenant owns its own Meta App)").option("--meta-business-id <id>", "Optional Meta Business Manager id").action(async (rawId, options) => {
135173
135545
  const client = getClient();
135174
135546
  try {
135175
135547
  const id = await resolveInstanceId(rawId);
135548
+ const wantsWhatsAppCloud = options.accessToken && options.phoneNumberId && options.wabaId;
135549
+ if (wantsWhatsAppCloud) {
135550
+ const instance = await client.instances.get(id);
135551
+ if (instance.channel !== "whatsapp-cloud") {
135552
+ error(`Instance ${id} is not a whatsapp-cloud instance (channel=${instance.channel}). --access-token/--phone-number-id/--waba-id only apply to whatsapp-cloud.`);
135553
+ return;
135554
+ }
135555
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), exports_config));
135556
+ const cfg = loadConfig2();
135557
+ const baseUrl = cfg.apiUrl ?? "http://localhost:8882";
135558
+ const apiKey = cfg.apiKey ?? "";
135559
+ const resp = await fetch(`${baseUrl}/api/v2/instances/${id}/whatsapp-cloud/connect`, {
135560
+ method: "POST",
135561
+ headers: { "Content-Type": "application/json", "x-api-key": apiKey },
135562
+ body: JSON.stringify({
135563
+ accessToken: options.accessToken,
135564
+ phoneNumberId: options.phoneNumberId,
135565
+ wabaId: options.wabaId,
135566
+ appId: options.metaAppId,
135567
+ businessId: options.metaBusinessId
135568
+ })
135569
+ });
135570
+ if (!resp.ok) {
135571
+ const err = await resp.json().catch(() => ({}));
135572
+ error(`Failed to connect: ${err?.error?.message ?? `HTTP ${resp.status}`}`);
135573
+ return;
135574
+ }
135575
+ const result2 = await resp.json();
135576
+ success("Instance connected via WhatsApp Cloud (manual)", {
135577
+ status: result2.data?.status ?? "connected",
135578
+ displayPhoneNumber: result2.data?.displayPhoneNumber ?? null,
135579
+ qualityRating: result2.data?.qualityRating ?? null
135580
+ });
135581
+ return;
135582
+ }
135176
135583
  const result = await client.instances.connect(id, {
135177
135584
  forceNewQr: options.forceNewQr,
135178
135585
  token: options.token,
@@ -2852,6 +2852,18 @@ export interface components {
2852
2852
  text: string;
2853
2853
  /** @description Message ID to reply to */
2854
2854
  replyTo?: string;
2855
+ /** @description Inline buttons — mapped natively per channel (WhatsApp Cloud: up to 3 reply buttons, 4-10 become a list; Telegram: inline keyboard) */
2856
+ buttons?: {
2857
+ /** @description Button label */
2858
+ text: string;
2859
+ /** @description Callback payload (reply button / list row id) */
2860
+ data?: string;
2861
+ /**
2862
+ * Format: uri
2863
+ * @description Link button URL (mutually exclusive with data)
2864
+ */
2865
+ url?: string;
2866
+ }[];
2855
2867
  };
2856
2868
  TTSVoice: {
2857
2869
  /** @description ElevenLabs voice ID */
@@ -7401,6 +7413,18 @@ export interface operations {
7401
7413
  text: string;
7402
7414
  /** @description Message ID to reply to */
7403
7415
  replyTo?: string;
7416
+ /** @description Inline buttons — mapped natively per channel (WhatsApp Cloud: up to 3 reply buttons, 4-10 become a list; Telegram: inline keyboard) */
7417
+ buttons?: {
7418
+ /** @description Button label */
7419
+ text: string;
7420
+ /** @description Callback payload (reply button / list row id) */
7421
+ data?: string;
7422
+ /**
7423
+ * Format: uri
7424
+ * @description Link button URL (mutually exclusive with data)
7425
+ */
7426
+ url?: string;
7427
+ }[];
7404
7428
  };
7405
7429
  };
7406
7430
  };