@zernio/node 0.2.63 → 0.2.65

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.
@@ -89,7 +89,10 @@ export type Ad = {
89
89
  platform?: 'facebook' | 'instagram' | 'tiktok' | 'linkedin' | 'pinterest' | 'google' | 'twitter';
90
90
  status?: AdStatus;
91
91
  adType?: 'boost' | 'standalone';
92
- goal?: 'engagement' | 'traffic' | 'awareness' | 'video_views';
92
+ /**
93
+ * Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
94
+ */
95
+ goal?: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
93
96
  /**
94
97
  * True for ads synced from platform ad managers
95
98
  */
@@ -206,7 +209,10 @@ export type platform = 'facebook' | 'instagram' | 'tiktok' | 'linkedin' | 'pinte
206
209
 
207
210
  export type adType = 'boost' | 'standalone';
208
211
 
209
- export type goal = 'engagement' | 'traffic' | 'awareness' | 'video_views';
212
+ /**
213
+ * Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
214
+ */
215
+ export type goal = 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
210
216
 
211
217
  export type type = 'daily' | 'lifetime';
212
218
 
@@ -534,6 +540,280 @@ export type BlueskyPlatformData = {
534
540
  }>;
535
541
  };
536
542
 
543
+ /**
544
+ * A single conversion event to relay to the ad platform. All PII fields
545
+ * (email, phone, names) are hashed with SHA-256 server-side using each
546
+ * platform's normalization rules before they leave Zernio. Callers send
547
+ * plaintext.
548
+ *
549
+ */
550
+ export type ConversionEvent = {
551
+ /**
552
+ * Standard event name (Purchase, Lead, CompleteRegistration, AddToCart,
553
+ * InitiateCheckout, AddPaymentInfo, Subscribe, StartTrial, ViewContent,
554
+ * Search, Contact, SubmitApplication, Schedule) or a custom string
555
+ * (only supported on platforms that accept custom events).
556
+ *
557
+ */
558
+ eventName: string;
559
+ /**
560
+ * When the conversion happened, in unix seconds.
561
+ */
562
+ eventTime: number;
563
+ /**
564
+ * Unique dedup key. The same eventId must be used on pixel + CAPI
565
+ * to prevent double-counting. Mapped to event_id on Meta and
566
+ * transactionId on Google.
567
+ *
568
+ */
569
+ eventId: string;
570
+ /**
571
+ * Conversion value in the specified currency.
572
+ */
573
+ value?: number;
574
+ /**
575
+ * ISO 4217 currency code.
576
+ */
577
+ currency?: string;
578
+ /**
579
+ * User identity fields. More signals mean higher match rates.
580
+ */
581
+ user: {
582
+ /**
583
+ * Plaintext email. Hashed server-side.
584
+ */
585
+ email?: string;
586
+ /**
587
+ * Phone number, ideally E.164. Hashed server-side.
588
+ */
589
+ phone?: string;
590
+ /**
591
+ * Plaintext first name. Hashed server-side.
592
+ */
593
+ firstName?: string;
594
+ /**
595
+ * Plaintext last name. Hashed server-side.
596
+ */
597
+ lastName?: string;
598
+ /**
599
+ * Stable customer identifier (e.g. CRM user ID). Hashed server-side.
600
+ */
601
+ externalId?: string;
602
+ /**
603
+ * Client IP address. Sent plaintext.
604
+ */
605
+ ipAddress?: string;
606
+ /**
607
+ * Client user-agent string. Sent plaintext.
608
+ */
609
+ userAgent?: string;
610
+ /**
611
+ * ISO 3166-1 alpha-2 country code, e.g. 'us'.
612
+ */
613
+ country?: string;
614
+ /**
615
+ * Platform click identifiers captured from the originating ad click.
616
+ */
617
+ clickIds?: {
618
+ /**
619
+ * Meta click ID (from fbclid URL param).
620
+ */
621
+ fbc?: string;
622
+ /**
623
+ * Meta browser ID (_fbp cookie).
624
+ */
625
+ fbp?: string;
626
+ /**
627
+ * Google click ID (from gclid URL param).
628
+ */
629
+ gclid?: string;
630
+ /**
631
+ * Google iOS 14.5+ app attribution ID.
632
+ */
633
+ gbraid?: string;
634
+ /**
635
+ * Google iOS 14.5+ web-to-app attribution ID.
636
+ */
637
+ wbraid?: string;
638
+ };
639
+ };
640
+ /**
641
+ * Item-level detail for ecommerce events.
642
+ */
643
+ items?: Array<{
644
+ id?: string;
645
+ name?: string;
646
+ price?: number;
647
+ quantity?: number;
648
+ category?: string;
649
+ }>;
650
+ /**
651
+ * URL where the conversion originated (used by Meta).
652
+ */
653
+ sourceUrl?: string;
654
+ /**
655
+ * Where the conversion happened. Used by Meta; Google ignores.
656
+ */
657
+ actionSource?: 'web' | 'app' | 'offline' | 'crm' | 'phone_call' | 'system_generated';
658
+ /**
659
+ * Escape hatch for platform-specific fields we haven't normalized. Forwarded as-is.
660
+ */
661
+ platformData?: {
662
+ [key: string]: unknown;
663
+ };
664
+ };
665
+
666
+ /**
667
+ * Where the conversion happened. Used by Meta; Google ignores.
668
+ */
669
+ export type actionSource = 'web' | 'app' | 'offline' | 'crm' | 'phone_call' | 'system_generated';
670
+
671
+ /**
672
+ * Discord message settings. Supports plain text (2,000 chars), rich embeds (up to 10), native polls, forum posts, threads, and announcement crossposts. Media attachments support images (JPEG, PNG, GIF, WebP), videos (MP4), and documents (up to 10 files, 25 MB each). Webhook identity (username + avatar) can be customized per-account via PATCH /v1/connect/discord or per-post via webhookUsername/webhookAvatarUrl.
673
+ *
674
+ */
675
+ export type DiscordPlatformData = {
676
+ /**
677
+ * Target channel snowflake ID. Determines which channel in the connected server receives the message.
678
+ */
679
+ channelId: string;
680
+ /**
681
+ * Up to 10 Discord embed objects (combined max 6,000 characters across all embeds). Sent alongside or instead of plain-text content.
682
+ */
683
+ embeds?: Array<{
684
+ /**
685
+ * Embed title (max 256 chars)
686
+ */
687
+ title?: string;
688
+ /**
689
+ * Embed body text (max 4,096 chars)
690
+ */
691
+ description?: string;
692
+ /**
693
+ * URL the title links to
694
+ */
695
+ url?: string;
696
+ /**
697
+ * Embed accent color as decimal integer (e.g. 5814783 for blue). Convert hex to decimal.
698
+ */
699
+ color?: number;
700
+ image?: {
701
+ url?: string;
702
+ };
703
+ thumbnail?: {
704
+ url?: string;
705
+ };
706
+ footer?: {
707
+ /**
708
+ * Footer text (max 2
709
+ */
710
+ text?: string;
711
+ icon_url?: string;
712
+ };
713
+ author?: {
714
+ /**
715
+ * Author name (max 256 chars)
716
+ */
717
+ name?: string;
718
+ url?: string;
719
+ icon_url?: string;
720
+ };
721
+ /**
722
+ * Up to 25 fields per embed
723
+ */
724
+ fields?: Array<{
725
+ /**
726
+ * Field name (max 256 chars)
727
+ */
728
+ name: string;
729
+ /**
730
+ * Field value (max 1
731
+ */
732
+ value: string;
733
+ /**
734
+ * Display fields side-by-side
735
+ */
736
+ inline?: boolean;
737
+ }>;
738
+ }>;
739
+ /**
740
+ * Native Discord poll. Cannot be combined with media attachments in the same message.
741
+ */
742
+ poll?: {
743
+ question?: {
744
+ /**
745
+ * Poll question (max 300 chars)
746
+ */
747
+ text: string;
748
+ };
749
+ /**
750
+ * 1-10 answer options
751
+ */
752
+ answers?: Array<{
753
+ poll_media?: {
754
+ /**
755
+ * Answer text
756
+ */
757
+ text?: string;
758
+ };
759
+ }>;
760
+ /**
761
+ * Poll duration in hours (1-768). Default 24.
762
+ */
763
+ duration?: number;
764
+ /**
765
+ * Allow users to select multiple answers. Default false.
766
+ */
767
+ allow_multiselect?: boolean;
768
+ };
769
+ /**
770
+ * Auto-crosspost to every server following this announcement channel (type 5). No-op for regular text channels.
771
+ */
772
+ crosspost?: boolean;
773
+ /**
774
+ * Thread title for forum channel posts (type 15). Required when posting to a forum channel.
775
+ */
776
+ forumThreadName?: string;
777
+ /**
778
+ * Tag snowflake IDs to apply to forum posts. Max 5 tags.
779
+ */
780
+ forumAppliedTags?: Array<(string)>;
781
+ /**
782
+ * Create a follow-up thread under the published message.
783
+ */
784
+ threadFromMessage?: {
785
+ /**
786
+ * Thread name (1-100 chars)
787
+ */
788
+ name?: string;
789
+ /**
790
+ * Auto-archive after inactivity (minutes)
791
+ */
792
+ autoArchiveDuration?: 60 | 1440 | 4320 | 10080;
793
+ /**
794
+ * Slow-mode duration in seconds (0-21600)
795
+ */
796
+ rateLimitPerUser?: number;
797
+ };
798
+ /**
799
+ * Send as text-to-speech message. Discord reads the message aloud in the channel.
800
+ */
801
+ tts?: boolean;
802
+ /**
803
+ * Override the webhook display name for this post only (1-80 chars). Falls back to the account-level default set via PATCH /v1/connect/discord.
804
+ */
805
+ webhookUsername?: string;
806
+ /**
807
+ * Override the webhook avatar URL for this post only. Falls back to the account-level default.
808
+ */
809
+ webhookAvatarUrl?: string;
810
+ };
811
+
812
+ /**
813
+ * Auto-archive after inactivity (minutes)
814
+ */
815
+ export type autoArchiveDuration = 60 | 1440 | 4320 | 10080;
816
+
537
817
  export type ErrorResponse = {
538
818
  error?: string;
539
819
  details?: {
@@ -1148,6 +1428,10 @@ export type PinterestPlatformData = {
1148
1428
  export type PlatformAnalytics = {
1149
1429
  platform?: string;
1150
1430
  status?: 'published' | 'failed';
1431
+ /**
1432
+ * The native post ID on the platform (e.g. Instagram media ID, tweet ID)
1433
+ */
1434
+ platformPostId?: (string) | null;
1151
1435
  accountId?: string;
1152
1436
  accountUsername?: (string) | null;
1153
1437
  analytics?: (PostAnalytics) | null;
@@ -1187,7 +1471,7 @@ export type PlatformTarget = {
1187
1471
  /**
1188
1472
  * Platform-specific overrides and options.
1189
1473
  */
1190
- platformSpecificData?: (TwitterPlatformData | ThreadsPlatformData | FacebookPlatformData | InstagramPlatformData | LinkedInPlatformData | PinterestPlatformData | YouTubePlatformData | GoogleBusinessPlatformData | TikTokPlatformData | TelegramPlatformData | SnapchatPlatformData | RedditPlatformData | BlueskyPlatformData);
1474
+ platformSpecificData?: (TwitterPlatformData | ThreadsPlatformData | FacebookPlatformData | InstagramPlatformData | LinkedInPlatformData | PinterestPlatformData | YouTubePlatformData | GoogleBusinessPlatformData | TikTokPlatformData | TelegramPlatformData | SnapchatPlatformData | RedditPlatformData | BlueskyPlatformData | DiscordPlatformData);
1191
1475
  /**
1192
1476
  * Platform-specific status: pending, publishing, published, failed
1193
1477
  */
@@ -3633,7 +3917,7 @@ export type CreatePostData = {
3633
3917
  * Optional per-platform scheduled time override. When omitted, the top-level scheduledFor is used.
3634
3918
  */
3635
3919
  scheduledFor?: string;
3636
- platformSpecificData?: (TwitterPlatformData | ThreadsPlatformData | FacebookPlatformData | InstagramPlatformData | LinkedInPlatformData | PinterestPlatformData | YouTubePlatformData | GoogleBusinessPlatformData | TikTokPlatformData | TelegramPlatformData | SnapchatPlatformData | RedditPlatformData | BlueskyPlatformData);
3920
+ platformSpecificData?: (TwitterPlatformData | ThreadsPlatformData | FacebookPlatformData | InstagramPlatformData | LinkedInPlatformData | PinterestPlatformData | YouTubePlatformData | GoogleBusinessPlatformData | TikTokPlatformData | TelegramPlatformData | SnapchatPlatformData | RedditPlatformData | BlueskyPlatformData | DiscordPlatformData);
3637
3921
  }>;
3638
3922
  scheduledFor?: string;
3639
3923
  publishNow?: boolean;
@@ -6512,6 +6796,131 @@ export type GetRedditFlairsError = (unknown | {
6512
6796
  error?: string;
6513
6797
  });
6514
6798
 
6799
+ export type GetDiscordSettingsData = {
6800
+ path: {
6801
+ accountId: string;
6802
+ };
6803
+ };
6804
+
6805
+ export type GetDiscordSettingsResponse = ({
6806
+ account?: {
6807
+ _id?: string;
6808
+ platform?: string;
6809
+ /**
6810
+ * Channel name
6811
+ */
6812
+ username?: string;
6813
+ /**
6814
+ * Guild - #channel display name
6815
+ */
6816
+ displayName?: string;
6817
+ /**
6818
+ * Guild icon URL
6819
+ */
6820
+ profilePicture?: string;
6821
+ /**
6822
+ * Connected channel snowflake ID
6823
+ */
6824
+ channelId?: string;
6825
+ /**
6826
+ * Channel name
6827
+ */
6828
+ channelName?: string;
6829
+ /**
6830
+ * Channel type (0 = text, 5 = announcement, 15 = forum)
6831
+ */
6832
+ channelType?: string;
6833
+ /**
6834
+ * Guild (server) snowflake ID
6835
+ */
6836
+ guildId?: string;
6837
+ /**
6838
+ * Custom webhook display name (null = default "Zernio")
6839
+ */
6840
+ webhookUsername?: (string) | null;
6841
+ /**
6842
+ * Custom webhook avatar URL (null = default bot avatar)
6843
+ */
6844
+ webhookAvatarUrl?: (string) | null;
6845
+ };
6846
+ });
6847
+
6848
+ export type GetDiscordSettingsError = (unknown | {
6849
+ error?: string;
6850
+ });
6851
+
6852
+ export type UpdateDiscordSettingsData = {
6853
+ body: {
6854
+ /**
6855
+ * Discord account ID
6856
+ */
6857
+ accountId: string;
6858
+ /**
6859
+ * Custom display name for the webhook (1-80 chars). Empty string resets to default ("Zernio"). Cannot contain "clyde" or "discord".
6860
+ */
6861
+ webhookUsername?: string;
6862
+ /**
6863
+ * Custom avatar URL. Empty string resets to default bot avatar.
6864
+ */
6865
+ webhookAvatarUrl?: string;
6866
+ /**
6867
+ * Switch to a different channel in the same guild. Must be a text (0), announcement (5), or forum (15) channel.
6868
+ */
6869
+ channelId?: string;
6870
+ };
6871
+ path: {
6872
+ accountId: string;
6873
+ };
6874
+ };
6875
+
6876
+ export type UpdateDiscordSettingsResponse = ({
6877
+ message?: string;
6878
+ account?: {
6879
+ _id?: string;
6880
+ platform?: string;
6881
+ username?: string;
6882
+ displayName?: string;
6883
+ profilePicture?: string;
6884
+ channelId?: string;
6885
+ channelName?: string;
6886
+ channelType?: string;
6887
+ guildId?: string;
6888
+ webhookUsername?: (string) | null;
6889
+ webhookAvatarUrl?: (string) | null;
6890
+ };
6891
+ });
6892
+
6893
+ export type UpdateDiscordSettingsError = (unknown | {
6894
+ error?: string;
6895
+ });
6896
+
6897
+ export type GetDiscordChannelsData = {
6898
+ path: {
6899
+ accountId: string;
6900
+ };
6901
+ };
6902
+
6903
+ export type GetDiscordChannelsResponse = ({
6904
+ channels?: Array<{
6905
+ /**
6906
+ * Channel snowflake ID
6907
+ */
6908
+ id?: string;
6909
+ /**
6910
+ * Channel name
6911
+ */
6912
+ name?: string;
6913
+ /**
6914
+ * Channel type: 0 (text), 5 (announcement), 15 (forum)
6915
+ */
6916
+ type?: number;
6917
+ }>;
6918
+ });
6919
+
6920
+ export type GetDiscordChannelsError = (unknown | {
6921
+ error?: string;
6922
+ });
6923
+
6515
6924
  export type ListQueueSlotsData = {
6516
6925
  query: {
6517
6926
  /**
@@ -11150,7 +11559,10 @@ export type BoostPostData = {
11150
11559
  */
11151
11560
  adAccountId: string;
11152
11561
  name: string;
11153
- goal: 'engagement' | 'traffic' | 'awareness' | 'video_views';
11562
+ /**
11563
+ * Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
11564
+ */
11565
+ goal: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
11154
11566
  budget: {
11155
11567
  /**
11156
11568
  * Minimum varies: TikTok=$20, Pinterest=$5, others=$1
@@ -11210,7 +11622,10 @@ export type CreateStandaloneAdData = {
11210
11622
  accountId: string;
11211
11623
  adAccountId: string;
11212
11624
  name: string;
11213
- goal: 'engagement' | 'traffic' | 'awareness' | 'video_views';
11625
+ /**
11626
+ * Available goals vary by platform. Meta (Facebook/Instagram) and TikTok support all 7. LinkedIn supports all except app_promotion. Twitter/X supports engagement, traffic, awareness, video_views, app_promotion. Pinterest and Google Ads support only engagement, traffic, awareness, video_views.
11627
+ */
11628
+ goal: 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lead_generation' | 'conversions' | 'app_promotion';
11214
11629
  budgetAmount: number;
11215
11630
  budgetType: 'daily' | 'lifetime';
11216
11631
  currency?: string;
@@ -11455,4 +11870,98 @@ export type AddUsersToAdAudienceResponse = ({
11455
11870
 
11456
11871
  export type AddUsersToAdAudienceError = (unknown | {
11457
11872
  error?: string;
11873
+ });
11874
+
11875
+ export type SendConversionsData = {
11876
+ body: {
11877
+ /**
11878
+ * SocialAccount ID (metaads or googleads).
11879
+ */
11880
+ accountId: string;
11881
+ /**
11882
+ * Platform destination identifier. For Meta, the pixel/dataset
11883
+ * ID. For Google, the conversion action resource name.
11884
+ *
11885
+ */
11886
+ destinationId: string;
11887
+ events: Array<ConversionEvent>;
11888
+ /**
11889
+ * Meta `test_event_code` passthrough. Ignored by Google.
11890
+ */
11891
+ testCode?: string;
11892
+ /**
11893
+ * Batch-level user consent. Required by Google for EEA/UK
11894
+ * events under the Feb 2026 restrictions. Ignored by Meta.
11895
+ *
11896
+ */
11897
+ consent?: {
11898
+ adUserData?: 'GRANTED' | 'DENIED';
11899
+ adPersonalization?: 'GRANTED' | 'DENIED';
11900
+ };
11901
+ };
11902
+ };
11903
+
11904
+ export type SendConversionsResponse = ({
11905
+ platform?: 'metaads' | 'googleads';
11906
+ /**
11907
+ * Events accepted by the platform.
11908
+ */
11909
+ eventsReceived?: number;
11910
+ /**
11911
+ * Events rejected (see failures).
11912
+ */
11913
+ eventsFailed?: number;
11914
+ failures?: Array<{
11915
+ /**
11916
+ * Index into the submitted events array.
11917
+ */
11918
+ eventIndex?: number;
11919
+ /**
11920
+ * Echoes back the eventId of the failed event.
11921
+ */
11922
+ eventId?: string;
11923
+ message?: string;
11924
+ code?: (string | number);
11925
+ }>;
11926
+ /**
11927
+ * Platform trace ID (fbtrace_id for Meta, requestId for Google) for debugging.
11928
+ */
11929
+ traceId?: string;
11930
+ });
11931
+
11932
+ export type SendConversionsError = (unknown | {
11933
+ error?: string;
11934
+ });
11935
+
11936
+ export type ListConversionDestinationsData = {
11937
+ path: {
11938
+ /**
11939
+ * SocialAccount ID (metaads or googleads).
11940
+ */
11941
+ accountId: string;
11942
+ };
11943
+ };
11944
+
11945
+ export type ListConversionDestinationsResponse = ({
11946
+ platform?: 'metaads' | 'googleads';
11947
+ destinations?: Array<{
11948
+ /**
11949
+ * Destination identifier. Meta: pixel ID. Google:
11950
+ * conversion action resource name.
11951
+ *
11952
+ */
11953
+ id?: string;
11954
+ name?: string;
11955
+ /**
11956
+ * Present when the platform locks event type to the
11957
+ * destination (Google conversion actions).
11958
+ *
11959
+ */
11960
+ type?: string;
11961
+ status?: 'active' | 'inactive';
11962
+ }>;
11963
+ });
11964
+
11965
+ export type ListConversionDestinationsError = (unknown | {
11966
+ error?: string;
11458
11967
  });