@zernio/node 0.2.140 → 0.2.142

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.
@@ -1001,6 +1001,49 @@ export type ConversionEvent = {
1001
1001
  */
1002
1002
  export type actionSource = 'web' | 'app' | 'offline' | 'crm' | 'phone_call' | 'system_generated';
1003
1003
 
1004
+ /**
1005
+ * Response returned by `POST /v1/ads/ctwa` when the request used the
1006
+ * multi-creative shape (`creatives[]`). N persisted Ad documents share
1007
+ * the returned `platformCampaignId` and `platformAdSetId`. `adType` is
1008
+ * the union discriminator.
1009
+ *
1010
+ */
1011
+ export type CtwaMultiResponse = {
1012
+ adType: 'multi';
1013
+ /**
1014
+ * The persisted Ad documents (one per creative), all sharing the same
1015
+ * `platformCampaignId` and `platformAdSetId`.
1016
+ *
1017
+ */
1018
+ ads: Array<{
1019
+ [key: string]: unknown;
1020
+ }>;
1021
+ platformCampaignId: string;
1022
+ platformAdSetId: string;
1023
+ message: string;
1024
+ };
1025
+
1026
+ export type adType2 = 'multi';
1027
+
1028
+ /**
1029
+ * Response returned by `POST /v1/ads/ctwa` when the request used the
1030
+ * single-creative shape (top-level headline / body / imageUrl|video).
1031
+ * `adType` is the union discriminator.
1032
+ *
1033
+ */
1034
+ export type CtwaSingleResponse = {
1035
+ adType: 'single';
1036
+ /**
1037
+ * The persisted Ad document.
1038
+ */
1039
+ ad: {
1040
+ [key: string]: unknown;
1041
+ };
1042
+ message: string;
1043
+ };
1044
+
1045
+ export type adType3 = 'single';
1046
+
1004
1047
  /**
1005
1048
  * 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.
1006
1049
  *
@@ -3031,7 +3074,7 @@ export type Webhook = {
3031
3074
  /**
3032
3075
  * Events subscribed to
3033
3076
  */
3034
- events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.failed' | 'comment.received' | 'review.new' | 'review.updated')>;
3077
+ events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.failed' | 'comment.received' | 'review.new' | 'review.updated' | 'ad.status_changed')>;
3035
3078
  /**
3036
3079
  * Whether webhook delivery is enabled
3037
3080
  */
@@ -3244,6 +3287,127 @@ export type event3 = 'account.disconnected';
3244
3287
  */
3245
3288
  export type disconnectionType = 'intentional' | 'unintentional';
3246
3289
 
3290
+ /**
3291
+ * Webhook payload for the `ad.status_changed` event. Currently emitted
3292
+ * only for Meta (`metaads`).
3293
+ *
3294
+ * Sourced from two Meta `ad_account` webhook fields:
3295
+ * - `in_process_ad_objects` - the ad object finished processing and
3296
+ * exited `IN_PROCESS`. `status.raw` carries Meta's `status_name`.
3297
+ * - `with_issues_ad_objects` - the ad object entered `WITH_ISSUES`.
3298
+ * `status.raw` is `WITH_ISSUES` and the `error` block is populated
3299
+ * from Meta's `error_code` / `error_summary` / `error_message`.
3300
+ *
3301
+ */
3302
+ export type WebhookPayloadAdStatusChanged = {
3303
+ /**
3304
+ * Stable webhook event ID
3305
+ */
3306
+ id: string;
3307
+ event: 'ad.status_changed';
3308
+ /**
3309
+ * The connected ad-platform account that owns the ad object.
3310
+ */
3311
+ account: {
3312
+ /**
3313
+ * Internal Zernio account ID (same as used in /v1/accounts/{accountId}).
3314
+ */
3315
+ accountId: string;
3316
+ /**
3317
+ * Internal Zernio profile ID this account belongs to.
3318
+ */
3319
+ profileId: string;
3320
+ /**
3321
+ * Ad platform identifier. Currently always `metaads`.
3322
+ */
3323
+ platform: string;
3324
+ /**
3325
+ * Display username of the connected ad-platform account.
3326
+ */
3327
+ username: string;
3328
+ /**
3329
+ * Human-readable display name of the account, when available.
3330
+ */
3331
+ displayName?: string;
3332
+ };
3333
+ /**
3334
+ * The ad-platform object the status change applies to.
3335
+ */
3336
+ adObject: {
3337
+ /**
3338
+ * Hierarchy level the status applies to. Mirrors Meta's `level`. Creative-level events are not forwarded.
3339
+ */
3340
+ level: 'CAMPAIGN' | 'AD_SET' | 'AD';
3341
+ /**
3342
+ * Platform-native ID of the campaign / ad set / ad. For Meta this is
3343
+ * the bare numeric ID (e.g. `120244894077860689`).
3344
+ *
3345
+ */
3346
+ platformId: string;
3347
+ /**
3348
+ * Platform-native ad-account ID. For Meta this uses the `act_<id>`
3349
+ * shape.
3350
+ *
3351
+ */
3352
+ platformAdAccountId: string;
3353
+ };
3354
+ /**
3355
+ * Status info. Branch on `status.raw` to handle each transition.
3356
+ */
3357
+ status: {
3358
+ /**
3359
+ * Platform-native status string, forwarded verbatim. For Meta
3360
+ * this is `status_name` from `in_process_ad_objects` (e.g.
3361
+ * `ACTIVE`, `PAUSED`, `PENDING_REVIEW`, `ARCHIVED`, `DELETED`,
3362
+ * `DISAPPROVED`), or `WITH_ISSUES` when sourced from
3363
+ * `with_issues_ad_objects`. Not constrained by an `enum` — Meta
3364
+ * may add new values.
3365
+ *
3366
+ */
3367
+ raw: string;
3368
+ };
3369
+ /**
3370
+ * Optional. Present on most `WITH_ISSUES` events, carrying the
3371
+ * platform's error diagnostics. May be absent on some `WITH_ISSUES`
3372
+ * events (Meta does not always include diagnostics). Always absent
3373
+ * for any other `status.raw` value. Always null-check before reading.
3374
+ *
3375
+ */
3376
+ error?: {
3377
+ /**
3378
+ * Platform-native error code, forwarded verbatim. For Meta this
3379
+ * is `error_code` as a string. Use as the stable discriminator —
3380
+ * `summary` and `message` are localized.
3381
+ *
3382
+ */
3383
+ code: string;
3384
+ /**
3385
+ * Short human-readable summary (Meta `error_summary`). Localized
3386
+ * to the ad-account owner's Meta locale — display only, do not
3387
+ * match on it.
3388
+ *
3389
+ */
3390
+ summary?: string;
3391
+ /**
3392
+ * Full human-readable error message (Meta `error_message`).
3393
+ * Localized — display only.
3394
+ *
3395
+ */
3396
+ message?: string;
3397
+ };
3398
+ /**
3399
+ * ISO-8601 timestamp the webhook was produced.
3400
+ */
3401
+ timestamp: string;
3402
+ };
3403
+
3404
+ export type event4 = 'ad.status_changed';
3405
+
3406
+ /**
3407
+ * Hierarchy level the status applies to. Mirrors Meta's `level`. Creative-level events are not forwarded.
3408
+ */
3409
+ export type level = 'CAMPAIGN' | 'AD_SET' | 'AD';
3410
+
3247
3411
  /**
3248
3412
  * Webhook payload for comment received events (Instagram, Facebook, Twitter/X, YouTube, LinkedIn, Bluesky, Reddit)
3249
3413
  */
@@ -3335,7 +3499,7 @@ export type WebhookPayloadComment = {
3335
3499
  timestamp: string;
3336
3500
  };
3337
3501
 
3338
- export type event4 = 'comment.received';
3502
+ export type event5 = 'comment.received';
3339
3503
 
3340
3504
  export type platform7 = 'instagram' | 'facebook' | 'twitter' | 'youtube' | 'linkedin' | 'bluesky' | 'reddit';
3341
3505
 
@@ -3623,7 +3787,7 @@ export type WebhookPayloadMessage = {
3623
3787
  timestamp: string;
3624
3788
  };
3625
3789
 
3626
- export type event5 = 'message.received';
3790
+ export type event6 = 'message.received';
3627
3791
 
3628
3792
  /**
3629
3793
  * WhatsApp only. Which kind of interactive reply the user sent:
@@ -3655,7 +3819,7 @@ export type WebhookPayloadMessageDeleted = {
3655
3819
  timestamp: string;
3656
3820
  };
3657
3821
 
3658
- export type event6 = 'message.deleted';
3822
+ export type event7 = 'message.deleted';
3659
3823
 
3660
3824
  /**
3661
3825
  * Shared payload for message.delivered, message.read, and
@@ -3690,7 +3854,7 @@ export type WebhookPayloadMessageDeliveryStatus = {
3690
3854
  timestamp: string;
3691
3855
  };
3692
3856
 
3693
- export type event7 = 'message.delivered' | 'message.read' | 'message.failed';
3857
+ export type event8 = 'message.delivered' | 'message.read' | 'message.failed';
3694
3858
 
3695
3859
  /**
3696
3860
  * Webhook payload for message.edited events. Fires when the sender
@@ -3732,7 +3896,7 @@ export type WebhookPayloadMessageEdited = {
3732
3896
  timestamp: string;
3733
3897
  };
3734
3898
 
3735
- export type event8 = 'message.edited';
3899
+ export type event9 = 'message.edited';
3736
3900
 
3737
3901
  /**
3738
3902
  * Webhook payload for message sent events (fired when a message is sent via the API)
@@ -3808,7 +3972,7 @@ export type WebhookPayloadMessageSent = {
3808
3972
  timestamp: string;
3809
3973
  };
3810
3974
 
3811
- export type event9 = 'message.sent';
3975
+ export type event10 = 'message.sent';
3812
3976
 
3813
3977
  /**
3814
3978
  * Webhook payload for post events
@@ -3836,7 +4000,7 @@ export type WebhookPayloadPost = {
3836
4000
  timestamp: string;
3837
4001
  };
3838
4002
 
3839
- export type event10 = 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled';
4003
+ export type event11 = 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled';
3840
4004
 
3841
4005
  /**
3842
4006
  * Webhook payload for the review.new event (new review posted on a connected account).
@@ -3856,7 +4020,7 @@ export type WebhookPayloadReviewNew = {
3856
4020
  timestamp: string;
3857
4021
  };
3858
4022
 
3859
- export type event11 = 'review.new';
4023
+ export type event12 = 'review.new';
3860
4024
 
3861
4025
  /**
3862
4026
  * Webhook payload for the review.updated event. Fired when the reviewer edits
@@ -3880,7 +4044,7 @@ export type WebhookPayloadReviewUpdated = {
3880
4044
  timestamp: string;
3881
4045
  };
3882
4046
 
3883
- export type event12 = 'review.updated';
4047
+ export type event13 = 'review.updated';
3884
4048
 
3885
4049
  /**
3886
4050
  * Webhook payload for test deliveries
@@ -3898,7 +4062,7 @@ export type WebhookPayloadTest = {
3898
4062
  timestamp: string;
3899
4063
  };
3900
4064
 
3901
- export type event13 = 'webhook.test';
4065
+ export type event14 = 'webhook.test';
3902
4066
 
3903
4067
  export type WhatsAppBodyComponent = {
3904
4068
  type: 'body';
@@ -7624,6 +7788,58 @@ export type BatchGetGoogleBusinessReviewsResponse = ({
7624
7788
 
7625
7789
  export type BatchGetGoogleBusinessReviewsError = (ErrorResponse);
7626
7790
 
7791
+ export type ReplyToGoogleBusinessReviewData = {
7792
+ body: {
7793
+ /**
7794
+ * The reply text to post on the review. Must be non-empty.
7795
+ */
7796
+ comment: string;
7797
+ };
7798
+ path: {
7799
+ /**
7800
+ * The Zernio account ID (from /v1/accounts)
7801
+ */
7802
+ accountId: string;
7803
+ /**
7804
+ * The review ID portion (e.g. "AIe9_BGx1234567890"), not the full resource name
7805
+ */
7806
+ reviewId: string;
7807
+ };
7808
+ };
7809
+
7810
+ export type ReplyToGoogleBusinessReviewResponse = ({
7811
+ success?: boolean;
7812
+ reviewId?: string;
7813
+ platform?: string;
7814
+ });
7815
+
7816
+ export type ReplyToGoogleBusinessReviewError = (ErrorResponse | {
7817
+ error?: string;
7818
+ });
7819
+
7820
+ export type DeleteGoogleBusinessReviewReplyData = {
7821
+ path: {
7822
+ /**
7823
+ * The Zernio account ID (from /v1/accounts)
7824
+ */
7825
+ accountId: string;
7826
+ /**
7827
+ * The review ID portion (e.g. "AIe9_BGx1234567890"), not the full resource name
7828
+ */
7829
+ reviewId: string;
7830
+ };
7831
+ };
7832
+
7833
+ export type DeleteGoogleBusinessReviewReplyResponse = ({
7834
+ success?: boolean;
7835
+ message?: string;
7836
+ platform?: string;
7837
+ });
7838
+
7839
+ export type DeleteGoogleBusinessReviewReplyError = (ErrorResponse | {
7840
+ error?: string;
7841
+ });
7842
+
7627
7843
  export type GetPendingOAuthDataData = {
7628
7844
  query: {
7629
7845
  /**
@@ -9176,7 +9392,7 @@ export type CreateWebhookSettingsData = {
9176
9392
  /**
9177
9393
  * Events to subscribe to (at least one required)
9178
9394
  */
9179
- events: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.failed' | 'comment.received' | 'review.new' | 'review.updated')>;
9395
+ events: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.failed' | 'comment.received' | 'review.new' | 'review.updated' | 'ad.status_changed')>;
9180
9396
  /**
9181
9397
  * Enable or disable webhook delivery. Defaults to `true` when omitted.
9182
9398
  */
@@ -9220,7 +9436,7 @@ export type UpdateWebhookSettingsData = {
9220
9436
  /**
9221
9437
  * Events to subscribe to. Must contain at least one event if provided.
9222
9438
  */
9223
- events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.failed' | 'comment.received' | 'review.new' | 'review.updated')>;
9439
+ events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.failed' | 'comment.received' | 'review.new' | 'review.updated' | 'ad.status_changed')>;
9224
9440
  /**
9225
9441
  * Enable or disable webhook delivery
9226
9442
  */
@@ -14212,6 +14428,10 @@ export type GetAdAnalyticsResponse = ({
14212
14428
  name?: string;
14213
14429
  platform?: string;
14214
14430
  status?: string;
14431
+ /**
14432
+ * ISO 4217 code of the ad account that owns this ad (e.g. USD, THB, INR). All money values in `summary` and `daily` are in this currency. Null only on legacy ads synced before currency was persisted.
14433
+ */
14434
+ currency?: (string) | null;
14215
14435
  };
14216
14436
  analytics?: {
14217
14437
  summary?: AdMetrics;
@@ -15644,22 +15864,35 @@ export type CreateCtwaAdData = {
15644
15864
  adAccountId: string;
15645
15865
  /**
15646
15866
  * Ad display name. Used to derive campaign / ad set names.
15867
+ * On the multi-creative shape, each ad's Meta name gets a
15868
+ * " #N" suffix (1-indexed) so Ads Manager shows them as a
15869
+ * numbered batch.
15870
+ *
15647
15871
  */
15648
15872
  name: string;
15649
- headline: string;
15650
15873
  /**
15651
- * Primary text shown above the image / video.
15874
+ * Single-creative shape only. Mutually exclusive with
15875
+ * `creatives[]`.
15876
+ *
15652
15877
  */
15653
- body: string;
15878
+ headline?: string;
15879
+ /**
15880
+ * Primary text shown above the image / video. Single-creative
15881
+ * shape only. Mutually exclusive with `creatives[]`.
15882
+ *
15883
+ */
15884
+ body?: string;
15654
15885
  /**
15655
- * Image asset for image creatives. Mutually exclusive with
15656
- * `video`. Required if `video` is not supplied.
15886
+ * Image asset for single-creative shape. Mutually exclusive
15887
+ * with `video` and with `creatives[]`. Required on the
15888
+ * single-creative shape if `video` is not supplied.
15657
15889
  *
15658
15890
  */
15659
15891
  imageUrl?: string;
15660
15892
  /**
15661
- * Video creative. Mutually exclusive with `imageUrl`.
15662
- * Required if `imageUrl` is not supplied.
15893
+ * Video creative for single-creative shape. Mutually
15894
+ * exclusive with `imageUrl` and with `creatives[]`. Required
15895
+ * on the single-creative shape if `imageUrl` is not supplied.
15663
15896
  *
15664
15897
  */
15665
15898
  video?: {
@@ -15671,6 +15904,42 @@ export type CreateCtwaAdData = {
15671
15904
  */
15672
15905
  thumbnailUrl: string;
15673
15906
  };
15907
+ /**
15908
+ * Multi-creative shape: N CTWA ads under one campaign + one
15909
+ * ad set, sharing budget and targeting. Mutually exclusive
15910
+ * with the top-level single-creative fields (`headline` /
15911
+ * `body` / `imageUrl` / `video`). Each entry must supply its
15912
+ * own headline, body, and exactly one of `imageUrl` /
15913
+ * `video`.
15914
+ *
15915
+ */
15916
+ creatives?: Array<{
15917
+ headline: string;
15918
+ /**
15919
+ * Primary text shown above the image / video.
15920
+ */
15921
+ body: string;
15922
+ /**
15923
+ * Image asset. Mutually exclusive with this entry's
15924
+ * `video`. Required if `video` is not supplied.
15925
+ *
15926
+ */
15927
+ imageUrl?: string;
15928
+ /**
15929
+ * Video creative. Mutually exclusive with this entry's
15930
+ * `imageUrl`. Required if `imageUrl` is not supplied.
15931
+ *
15932
+ */
15933
+ video?: {
15934
+ url: string;
15935
+ /**
15936
+ * Required by Meta for every video creative. Used
15937
+ * as the ad thumbnail.
15938
+ *
15939
+ */
15940
+ thumbnailUrl: string;
15941
+ };
15942
+ }>;
15674
15943
  /**
15675
15944
  * Budget amount in the ad account's currency major units
15676
15945
  * (e.g. dollars for USD, not cents). Must be > 0.
@@ -15720,6 +15989,31 @@ export type CreateCtwaAdData = {
15720
15989
  *
15721
15990
  */
15722
15991
  objective?: 'OUTCOME_ENGAGEMENT' | 'OUTCOME_SALES' | 'OUTCOME_LEADS';
15992
+ /**
15993
+ * Meta bid strategy applied to the shared ad set. Defaults to
15994
+ * `LOWEST_COST_WITHOUT_CAP` (auto-bid) when omitted.
15995
+ * `LOWEST_COST_WITH_BID_CAP` and `COST_CAP` require
15996
+ * `bidAmount`. `LOWEST_COST_WITH_MIN_ROAS` requires
15997
+ * `roasAverageFloor`. CTWA's `optimization_goal` is fixed to
15998
+ * `CONVERSATIONS`, but the bid strategy is independent.
15999
+ *
16000
+ */
16001
+ bidStrategy?: 'LOWEST_COST_WITHOUT_CAP' | 'LOWEST_COST_WITH_BID_CAP' | 'COST_CAP' | 'LOWEST_COST_WITH_MIN_ROAS';
16002
+ /**
16003
+ * Whole currency units (e.g. `5` = $5.00 on a USD account).
16004
+ * Required when `bidStrategy` is `LOWEST_COST_WITH_BID_CAP`
16005
+ * or `COST_CAP`; rejected otherwise.
16006
+ *
16007
+ */
16008
+ bidAmount?: number;
16009
+ /**
16010
+ * Decimal ROAS multiplier (e.g. `2.0` = 2.0× ROAS floor).
16011
+ * Required when `bidStrategy` is `LOWEST_COST_WITH_MIN_ROAS`;
16012
+ * rejected otherwise. Meta enforces its own upper bound
16013
+ * server-side.
16014
+ *
16015
+ */
16016
+ roasAverageFloor?: number;
15723
16017
  /**
15724
16018
  * Name of the legal entity benefiting from the ad.
15725
16019
  * Required by Meta when targeting EU users (DSA Article 26).
@@ -15737,15 +16031,7 @@ export type CreateCtwaAdData = {
15737
16031
  };
15738
16032
  };
15739
16033
 
15740
- export type CreateCtwaAdResponse = ({
15741
- /**
15742
- * The persisted Ad document.
15743
- */
15744
- ad?: {
15745
- [key: string]: unknown;
15746
- };
15747
- message?: string;
15748
- });
16034
+ export type CreateCtwaAdResponse = ((CtwaSingleResponse | CtwaMultiResponse));
15749
16035
 
15750
16036
  export type CreateCtwaAdError = (unknown | {
15751
16037
  error?: string;