@getlatedev/node 0.2.1285 → 0.2.1287

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.
@@ -4483,6 +4483,74 @@ export type ConnectWelcomeScreen = {
4483
4483
  } | null;
4484
4484
  };
4485
4485
 
4486
+ /**
4487
+ * The ad that opened the conversation, enriched from the ads Zernio syncs for
4488
+ * the account owner. null when the conversation did not start from a Meta
4489
+ * referral (ad click or ig.me / m.me ref link).
4490
+ *
4491
+ * Meta's referral carries the ad ID but no campaign or ad set ID. When the ad
4492
+ * is in your synced ads (`GET /v1/ads`), `synced` is true and the ad name,
4493
+ * campaign, ad set and ad account come from there. Otherwise `synced` is false,
4494
+ * `name` falls back to the ad title (Instagram, Facebook) or headline (WhatsApp)
4495
+ * Meta sent with the click, and the other fields are null.
4496
+ *
4497
+ * A team member limited to some profiles, or an API key scoped to profiles, is
4498
+ * enriched only from the ads it can list with `GET /v1/ads`; any other ad comes
4499
+ * back `synced` false.
4500
+ *
4501
+ * A non-null object with `adId` null is a referral that is not an ad click:
4502
+ * an ig.me / m.me ref link (`name` null) or a WhatsApp click on a post
4503
+ * (`ctwa_source_type` post, `name` is Meta's headline). Nothing is looked up
4504
+ * in your ads for it and `synced` is false.
4505
+ *
4506
+ */
4507
+ export type ConversationAdAttribution = {
4508
+ /**
4509
+ * Meta's ad ID: `meta_ad_id` on Instagram and Facebook, `ctwa_source_id` on WhatsApp when `ctwa_source_type` is `ad`. Accepted by `GET /v1/ads/{adId}`.
4510
+ */
4511
+ adId: (string) | null;
4512
+ /**
4513
+ * The synced ad's name, else the ad title or headline Meta sent.
4514
+ */
4515
+ name: (string) | null;
4516
+ /**
4517
+ * True when the ad was found in your synced ads.
4518
+ */
4519
+ synced: boolean;
4520
+ /**
4521
+ * Meta campaign ID. Synced ads only.
4522
+ */
4523
+ campaignId: (string) | null;
4524
+ /**
4525
+ * Campaign name. Synced ads only.
4526
+ */
4527
+ campaignName: (string) | null;
4528
+ /**
4529
+ * Meta ad set ID. Synced ads only.
4530
+ */
4531
+ adSetId: (string) | null;
4532
+ /**
4533
+ * Ad set name. Synced ads only.
4534
+ */
4535
+ adSetName: (string) | null;
4536
+ /**
4537
+ * Meta ad account ID (act_...). Synced ads only.
4538
+ */
4539
+ adAccountId: (string) | null;
4540
+ /**
4541
+ * Ad account name. Synced ads only.
4542
+ */
4543
+ adAccountName: (string) | null;
4544
+ /**
4545
+ * The post the ad promotes, from the synced ad or else Meta's `post_id` on the click.
4546
+ */
4547
+ platformPostId: (string) | null;
4548
+ /**
4549
+ * True when the ad was created outside Zernio (synced from Ads Manager), false when created through Zernio, null when not synced.
4550
+ */
4551
+ isExternal: (boolean) | null;
4552
+ } | null;
4553
+
4486
4554
  /**
4487
4555
  * A Google Ads conversion action, e.g. a WEBPAGE conversion created via
4488
4556
  * `createConversionAction`. Returned by `listConversionActions` and
@@ -7912,6 +7980,137 @@ export type region = 'US' | 'GB';
7912
7980
  */
7913
7981
  export type status24 = 'ordering' | 'awaiting_payment' | 'activating' | 'active' | 'suspended' | 'canceled' | 'failed';
7914
7982
 
7983
+ /**
7984
+ * Click attribution for a conversation that started from a Meta ad or
7985
+ * a ref-tagged ig.me / m.me link, as Meta sent it. Absent when the
7986
+ * conversation did not originate from an attributable click. For the ad
7987
+ * name, campaign and ad set read `adAttribution` instead.
7988
+ *
7989
+ * Captured from the referral Meta delivers for the click. If the same
7990
+ * person later arrives through a different ad or link, the original
7991
+ * values are kept, so the first referral wins; read the fresh referral
7992
+ * per click on the `message.received` / `referral.received` webhooks
7993
+ * instead. On Instagram Click-to-Direct Meta usually delivers the ad post
7994
+ * first as an attachment-only `share` / `ig_post` message with no
7995
+ * referral, then attaches the referral to the next message. One exception
7996
+ * on WhatsApp: when Meta omits `ctwa_clid` from that referral, a later
7997
+ * Meta automatic event can supply it and refresh `ctwa_captured_at`, so
7998
+ * treat `ctwa_captured_at` as the time Zernio stored the value, not the
7999
+ * time of the click.
8000
+ *
8001
+ * Two families of keys, one per surface. They never appear together:
8002
+ *
8003
+ * - `ctwa_*` is WhatsApp Click-to-WhatsApp. The ad ID is
8004
+ * `ctwa_source_id`. There is no `meta_ad_id` on WhatsApp.
8005
+ * - `meta_ad_*` is Instagram Click-to-Direct, Facebook Messenger
8006
+ * Click-to-Message, and ig.me / m.me ref links. The ad ID is
8007
+ * `meta_ad_id` (ad clicks only; a link capture carries
8008
+ * `meta_ad_ref` without it). `ctwa_clid` never appears on these
8009
+ * platforms.
8010
+ *
8011
+ * Every key is optional and only the keys Meta supplied are returned, so
8012
+ * read defensively. Meta does not send a campaign or ad set ID; they are
8013
+ * resolved from your synced ads in `adAttribution`. More keys may be added
8014
+ * over time. Treat any key you do not recognise as an opaque string.
8015
+ *
8016
+ * Key names differ from the `message.received` webhook on purpose. The
8017
+ * webhook forwards Meta's referral verbatim (`ad_id`, `source`, `type`)
8018
+ * while the stored conversation record uses the prefixed names below.
8019
+ * Renaming either side would break existing integrations, so both
8020
+ * spellings are kept.
8021
+ *
8022
+ */
8023
+ export type InboxConversationAdMetadata = {
8024
+ /**
8025
+ * WhatsApp only. Meta's click identifier, the value to forward to the Meta Conversions API for Business Messaging. Meta omits it on some numbers, so a WhatsApp referral can arrive without it.
8026
+ */
8027
+ ctwa_clid?: string;
8028
+ /**
8029
+ * WhatsApp only. The Meta ad ID the user clicked (or the post ID when `ctwa_source_type` is post). This is the WhatsApp equivalent of meta_ad_id.
8030
+ */
8031
+ ctwa_source_id?: string;
8032
+ /**
8033
+ * WhatsApp only. What the user clicked, as supplied by Meta (for example ad or post).
8034
+ */
8035
+ ctwa_source_type?: string;
8036
+ /**
8037
+ * WhatsApp only. Meta's URL for the ad that was clicked, normally an fb.me short link.
8038
+ */
8039
+ ctwa_source_url?: string;
8040
+ /**
8041
+ * WhatsApp only. Headline of the ad creative at click time.
8042
+ */
8043
+ ctwa_headline?: string;
8044
+ /**
8045
+ * WhatsApp only. Body text of the ad creative at click time.
8046
+ */
8047
+ ctwa_body?: string;
8048
+ /**
8049
+ * WhatsApp only. Media type of the ad creative, image or video.
8050
+ */
8051
+ ctwa_media_type?: string;
8052
+ /**
8053
+ * WhatsApp only. Image of the ad creative at click time (image ads).
8054
+ */
8055
+ ctwa_image_url?: string;
8056
+ /**
8057
+ * WhatsApp only. Video of the ad creative at click time (video ads).
8058
+ */
8059
+ ctwa_video_url?: string;
8060
+ /**
8061
+ * WhatsApp only. Thumbnail of the ad video at click time (video ads).
8062
+ */
8063
+ ctwa_thumbnail_url?: string;
8064
+ /**
8065
+ * WhatsApp only. When Zernio stored this referral. Always present when a WhatsApp referral was captured.
8066
+ */
8067
+ ctwa_captured_at?: string;
8068
+ /**
8069
+ * Instagram and Facebook only. The Meta ad ID the user clicked. Present for ad clicks; absent when the capture came from an ig.me / m.me ref link.
8070
+ */
8071
+ meta_ad_id?: string;
8072
+ /**
8073
+ * Instagram and Facebook only. Meta-supplied source identifier: ADS for ad clicks; SHORTLINK, SHORTLINKS or IGME-SOURCE-LINK for ref links (treat as opaque).
8074
+ */
8075
+ meta_ad_source?: string;
8076
+ /**
8077
+ * Instagram and Facebook only. Meta-supplied referral type, for example OPEN_THREAD.
8078
+ */
8079
+ meta_ad_type?: string;
8080
+ /**
8081
+ * Instagram and Facebook only. The ref parameter passed through from the ad creative or the ig.me / m.me link.
8082
+ */
8083
+ meta_ad_ref?: string;
8084
+ /**
8085
+ * Instagram and Facebook only. Title of the ad creative at click time.
8086
+ */
8087
+ meta_ad_title?: string;
8088
+ /**
8089
+ * Instagram and Facebook only. Image of the ad creative at click time.
8090
+ */
8091
+ meta_ad_photo_url?: string;
8092
+ /**
8093
+ * Instagram and Facebook only. Video of the ad creative at click time.
8094
+ */
8095
+ meta_ad_video_url?: string;
8096
+ /**
8097
+ * Instagram and Facebook only. The organic post the ad promoted, when the ad was a boosted post.
8098
+ */
8099
+ meta_ad_post_id?: string;
8100
+ /**
8101
+ * Instagram and Facebook only. The catalogue product the user clicked, for product ads.
8102
+ */
8103
+ meta_ad_product_id?: string;
8104
+ /**
8105
+ * Instagram and Facebook only. The Meta flow the ad launched, for flow ads.
8106
+ */
8107
+ meta_ad_flow_id?: string;
8108
+ /**
8109
+ * Instagram and Facebook only. When Zernio stored this referral. Always present when an Instagram or Facebook referral was captured.
8110
+ */
8111
+ meta_ad_captured_at?: string;
8112
+ } | null;
8113
+
7915
8114
  /**
7916
8115
  * Attachment snapshot inside an edit-history entry.
7917
8116
  */
@@ -13273,7 +13472,7 @@ export type Webhook = {
13273
13472
  /**
13274
13473
  * Events subscribed to
13275
13474
  */
13276
- events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'conversation.started' | 'conversation.control_changed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'comment.received' | 'review.new' | 'review.updated' | 'lead.received' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.video.processed' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.automatic_event' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'verification.approved' | 'verification.failed' | 'api.changelog.published' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed')>;
13475
+ events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'conversation.started' | 'conversation.control_changed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'comment.received' | 'review.new' | 'review.updated' | 'lead.received' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.delivery_issue' | 'campaign.budget.depleted' | 'ad_account.status_changed' | 'ad.video.processed' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.automatic_event' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'verification.approved' | 'verification.failed' | 'api.changelog.published' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed')>;
13277
13476
  /**
13278
13477
  * Whether webhook delivery is enabled
13279
13478
  */
@@ -13306,6 +13505,26 @@ export type Webhook = {
13306
13505
  accountIds?: Array<(string)>;
13307
13506
  };
13308
13507
 
13508
+ /**
13509
+ * The connected ads account the event belongs to.
13510
+ */
13511
+ export type WebhookAdsAccount = {
13512
+ /**
13513
+ * Internal Zernio account ID (same as used in /v1/accounts/{accountId}).
13514
+ */
13515
+ accountId: string;
13516
+ /**
13517
+ * Internal Zernio profile ID this account belongs to.
13518
+ */
13519
+ profileId: string;
13520
+ /**
13521
+ * Ads connection platform (`metaads`, `googleads`, `tiktokads`, `linkedinads`, `pinterestads`, `xads`, ...).
13522
+ */
13523
+ platform: string;
13524
+ username: string;
13525
+ displayName?: (string) | null;
13526
+ };
13527
+
13309
13528
  export type WebhookAdsSyncAccount = {
13310
13529
  /**
13311
13530
  * The ads connection's account ID (same as used in /v1/accounts/{accountId})
@@ -13706,6 +13925,126 @@ export type event5 = 'account.disconnected';
13706
13925
  */
13707
13926
  export type disconnectionType = 'intentional' | 'unintentional';
13708
13927
 
13928
+ /**
13929
+ * Webhook payload for the `ad_account.status_changed` event. Fires when an ad
13930
+ * account Zernio already tracked moves between `active`, `restricted`, `disabled`
13931
+ * and `closed`, as read by Zernio's ad account discovery (Meta, Google, TikTok, X).
13932
+ * An account seen for the first time, an account not seen in the last 48 hours,
13933
+ * or a platform status Zernio does not recognize, never fires it.
13934
+ *
13935
+ * `restricted` means the account exists but cannot run ads normally until
13936
+ * something is settled (Meta unpaid balance or risk review, TikTok limits or
13937
+ * pending verification, X review). Each new status fires at most once per
13938
+ * account per 24 hours.
13939
+ *
13940
+ */
13941
+ export type WebhookPayloadAdAccountStatusChanged = {
13942
+ /**
13943
+ * Stable webhook event ID: the dedupe key, also sent as the X-Zernio-Event-Id header and identical on every retry and redelivery.
13944
+ */
13945
+ id: string;
13946
+ profiles?: WebhookProfiles;
13947
+ /**
13948
+ * Always true when present: only a sample sent by POST /v1/webhooks/test with an event carries it. Real deliveries never do.
13949
+ */
13950
+ test?: boolean;
13951
+ event: 'ad_account.status_changed';
13952
+ account: WebhookAdsAccount;
13953
+ adAccount: {
13954
+ /**
13955
+ * Platform-native ad account ID.
13956
+ */
13957
+ platformAdAccountId: string;
13958
+ name: (string) | null;
13959
+ };
13960
+ status: {
13961
+ previous: 'active' | 'restricted' | 'disabled' | 'closed';
13962
+ current: 'active' | 'restricted' | 'disabled' | 'closed';
13963
+ /**
13964
+ * Platform-native status, forwarded verbatim (Meta `account_status` code such as `2`, Google `SUSPENDED`, TikTok `STATUS_LIMIT`, X `REJECTED`).
13965
+ */
13966
+ raw: string;
13967
+ };
13968
+ /**
13969
+ * UTC time at which Zernio generated this event.
13970
+ */
13971
+ timestamp: string;
13972
+ };
13973
+
13974
+ export type event6 = 'ad_account.status_changed';
13975
+
13976
+ export type previous = 'active' | 'restricted' | 'disabled' | 'closed';
13977
+
13978
+ export type current = 'active' | 'restricted' | 'disabled' | 'closed';
13979
+
13980
+ /**
13981
+ * Webhook payload for the `ad.delivery_issue` event. Fires when an ad Zernio
13982
+ * already tracked moves into the platform's error state: Meta `WITH_ISSUES`
13983
+ * (payment, policy and account problems), TikTok account punishment or missing
13984
+ * balance, LinkedIn removals, and any platform status Zernio does not recognize
13985
+ * yet (check `issue.raw`). Ads seen for the first time by a sync never fire it.
13986
+ *
13987
+ * Detected by Zernio's own ad sync, so it arrives within one sync cycle. Each
13988
+ * ad fires at most once per 24 hours. On Meta, `ad.status_changed` with
13989
+ * `WITH_ISSUES` can also fire for the same problem, straight from Meta's webhook.
13990
+ *
13991
+ */
13992
+ export type WebhookPayloadAdDeliveryIssue = {
13993
+ /**
13994
+ * Stable webhook event ID: the dedupe key, also sent as the X-Zernio-Event-Id header and identical on every retry and redelivery.
13995
+ */
13996
+ id: string;
13997
+ profiles?: WebhookProfiles;
13998
+ /**
13999
+ * Always true when present: only a sample sent by POST /v1/webhooks/test with an event carries it. Real deliveries never do.
14000
+ */
14001
+ test?: boolean;
14002
+ event: 'ad.delivery_issue';
14003
+ account: WebhookAdsAccount;
14004
+ adObject: {
14005
+ /**
14006
+ * Always `AD`.
14007
+ */
14008
+ level: 'AD';
14009
+ /**
14010
+ * Platform-native ad ID.
14011
+ */
14012
+ platformId: string;
14013
+ /**
14014
+ * Platform-native ad account ID.
14015
+ */
14016
+ platformAdAccountId: string;
14017
+ /**
14018
+ * Zernio ad ID, usable with GET /v1/ads/{adId}.
14019
+ */
14020
+ adId: string;
14021
+ name: string;
14022
+ };
14023
+ issue: {
14024
+ /**
14025
+ * Platform-native status string, forwarded verbatim (Meta `WITH_ISSUES`, TikTok `ADVERTISER_ACCOUNT_PUNISH`, LinkedIn `REMOVED`, ...).
14026
+ */
14027
+ raw: string;
14028
+ /**
14029
+ * What the platform says is wrong. Meta reports it per campaign; other networks send no message today, so it is empty there.
14030
+ */
14031
+ reasons: Array<{
14032
+ message: string;
14033
+ }>;
14034
+ };
14035
+ /**
14036
+ * UTC time at which Zernio generated this event.
14037
+ */
14038
+ timestamp: string;
14039
+ };
14040
+
14041
+ export type event7 = 'ad.delivery_issue';
14042
+
14043
+ /**
14044
+ * Always `AD`.
14045
+ */
14046
+ export type level2 = 'AD';
14047
+
13709
14048
  /**
13710
14049
  * Webhook payload for the `ad.review.approved` and `ad.review.rejected` events.
13711
14050
  * Emitted for every ad network Zernio syncs (Meta, Google, TikTok, LinkedIn,
@@ -13734,25 +14073,7 @@ export type WebhookPayloadAdReview = {
13734
14073
  */
13735
14074
  test?: boolean;
13736
14075
  event: 'ad.review.approved' | 'ad.review.rejected';
13737
- /**
13738
- * The connected ads account that owns the ad.
13739
- */
13740
- account: {
13741
- /**
13742
- * Internal Zernio account ID (same as used in /v1/accounts/{accountId}).
13743
- */
13744
- accountId: string;
13745
- /**
13746
- * Internal Zernio profile ID this account belongs to.
13747
- */
13748
- profileId: string;
13749
- /**
13750
- * Ads connection platform (`metaads`, `googleads`, `tiktokads`, `linkedinads`, `pinterestads`, `xads`, ...).
13751
- */
13752
- platform: string;
13753
- username: string;
13754
- displayName?: (string) | null;
13755
- };
14076
+ account: WebhookAdsAccount;
13756
14077
  adObject: {
13757
14078
  /**
13758
14079
  * Always `AD`.
@@ -13791,12 +14112,7 @@ export type WebhookPayloadAdReview = {
13791
14112
  timestamp: string;
13792
14113
  };
13793
14114
 
13794
- export type event6 = 'ad.review.approved' | 'ad.review.rejected';
13795
-
13796
- /**
13797
- * Always `AD`.
13798
- */
13799
- export type level2 = 'AD';
14115
+ export type event8 = 'ad.review.approved' | 'ad.review.rejected';
13800
14116
 
13801
14117
  export type status38 = 'approved' | 'rejected';
13802
14118
 
@@ -13925,7 +14241,7 @@ export type WebhookPayloadAdStatusChanged = {
13925
14241
  timestamp: string;
13926
14242
  };
13927
14243
 
13928
- export type event7 = 'ad.status_changed';
14244
+ export type event9 = 'ad.status_changed';
13929
14245
 
13930
14246
  /**
13931
14247
  * Hierarchy level the status applies to. Mirrors Meta's `level`. Creative-level events are not forwarded.
@@ -13996,7 +14312,7 @@ export type WebhookPayloadAdVideoProcessed = {
13996
14312
  timestamp: string;
13997
14313
  };
13998
14314
 
13999
- export type event8 = 'ad.video.processed';
14315
+ export type event10 = 'ad.video.processed';
14000
14316
 
14001
14317
  /**
14002
14318
  * `ready`: usable as `video.id` on the create endpoints. `error`: Meta could not process it; upload again.
@@ -14079,7 +14395,7 @@ export type WebhookPayloadAnalyticsSynced = {
14079
14395
  timestamp: string;
14080
14396
  };
14081
14397
 
14082
- export type event9 = 'analytics.synced';
14398
+ export type event11 = 'analytics.synced';
14083
14399
 
14084
14400
  export type WebhookPayloadApiChangelogPublished = {
14085
14401
  /**
@@ -14098,7 +14414,7 @@ export type WebhookPayloadApiChangelogPublished = {
14098
14414
  timestamp: string;
14099
14415
  };
14100
14416
 
14101
- export type event10 = 'api.changelog.published';
14417
+ export type event12 = 'api.changelog.published';
14102
14418
 
14103
14419
  /**
14104
14420
  * Webhook payload for the `call.ended` event. Fires on call hangup
@@ -14173,7 +14489,7 @@ export type WebhookPayloadCallEnded = {
14173
14489
  timestamp: string;
14174
14490
  };
14175
14491
 
14176
- export type event11 = 'call.ended';
14492
+ export type event13 = 'call.ended';
14177
14493
 
14178
14494
  /**
14179
14495
  * Webhook payload for the `call.failed` event. Fired when a call
@@ -14212,7 +14528,7 @@ export type WebhookPayloadCallFailed = {
14212
14528
  timestamp: string;
14213
14529
  };
14214
14530
 
14215
- export type event12 = 'call.failed';
14531
+ export type event14 = 'call.failed';
14216
14532
 
14217
14533
  /**
14218
14534
  * Webhook payload for the `call.permission_request` event. Fires
@@ -14254,7 +14570,7 @@ export type WebhookPayloadCallPermissionRequest = {
14254
14570
  timestamp: string;
14255
14571
  };
14256
14572
 
14257
- export type event13 = 'call.permission_request';
14573
+ export type event15 = 'call.permission_request';
14258
14574
 
14259
14575
  export type response = 'accept' | 'reject';
14260
14576
 
@@ -14313,7 +14629,63 @@ export type WebhookPayloadCallReceived = {
14313
14629
  timestamp: string;
14314
14630
  };
14315
14631
 
14316
- export type event14 = 'call.received';
14632
+ export type event16 = 'call.received';
14633
+
14634
+ /**
14635
+ * Webhook payload for the `campaign.budget.depleted` event. Fires when a campaign
14636
+ * Zernio already tracked stops delivering because its budget ran out. TikTok only:
14637
+ * it is the one network that reports an exhausted budget on the ad. Meta and Google
14638
+ * keep such ads `ACTIVE`, so they never fire it.
14639
+ *
14640
+ * Detected by Zernio's own ad sync. Each campaign fires at most once per 6 hours, so a
14641
+ * daily budget that runs out again the next day is announced again.
14642
+ *
14643
+ */
14644
+ export type WebhookPayloadCampaignBudgetDepleted = {
14645
+ /**
14646
+ * Stable webhook event ID: the dedupe key, also sent as the X-Zernio-Event-Id header and identical on every retry and redelivery.
14647
+ */
14648
+ id: string;
14649
+ profiles?: WebhookProfiles;
14650
+ /**
14651
+ * Always true when present: only a sample sent by POST /v1/webhooks/test with an event carries it. Real deliveries never do.
14652
+ */
14653
+ test?: boolean;
14654
+ event: 'campaign.budget.depleted';
14655
+ account: WebhookAdsAccount;
14656
+ adObject: {
14657
+ /**
14658
+ * Always `CAMPAIGN`.
14659
+ */
14660
+ level: 'CAMPAIGN';
14661
+ /**
14662
+ * Platform-native campaign ID.
14663
+ */
14664
+ platformId: string;
14665
+ /**
14666
+ * Platform-native ad account ID.
14667
+ */
14668
+ platformAdAccountId: string;
14669
+ name: (string) | null;
14670
+ };
14671
+ budget: {
14672
+ /**
14673
+ * Platform-native status string, forwarded verbatim (TikTok `AD_STATUS_CAMPAIGN_EXCEED`).
14674
+ */
14675
+ raw: string;
14676
+ };
14677
+ /**
14678
+ * UTC time at which Zernio generated this event.
14679
+ */
14680
+ timestamp: string;
14681
+ };
14682
+
14683
+ export type event17 = 'campaign.budget.depleted';
14684
+
14685
+ /**
14686
+ * Always `CAMPAIGN`.
14687
+ */
14688
+ export type level4 = 'CAMPAIGN';
14317
14689
 
14318
14690
  /**
14319
14691
  * Webhook payload for comment received events (Instagram, Facebook, Threads, YouTube, LinkedIn, Bluesky, Reddit, TikTok). X/Twitter does NOT fire this event. TikTok events carry only the author id: the comment.update webhook has no username, picture or owner flag.
@@ -14490,7 +14862,7 @@ export type WebhookPayloadComment = {
14490
14862
  timestamp: string;
14491
14863
  };
14492
14864
 
14493
- export type event15 = 'comment.received';
14865
+ export type event18 = 'comment.received';
14494
14866
 
14495
14867
  export type platform15 = 'instagram' | 'facebook' | 'threads' | 'youtube' | 'linkedin' | 'bluesky' | 'reddit' | 'tiktok';
14496
14868
 
@@ -14536,7 +14908,7 @@ export type WebhookPayloadCommerceOrder = {
14536
14908
  };
14537
14909
  };
14538
14910
 
14539
- export type event16 = 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded';
14911
+ export type event19 = 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded';
14540
14912
 
14541
14913
  export type type17 = 'order';
14542
14914
 
@@ -14579,7 +14951,7 @@ export type WebhookPayloadCommerceProduct = {
14579
14951
  };
14580
14952
  };
14581
14953
 
14582
- export type event17 = 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted';
14954
+ export type event20 = 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted';
14583
14955
 
14584
14956
  export type type18 = 'product';
14585
14957
 
@@ -14619,7 +14991,7 @@ export type WebhookPayloadContactFieldChanged = {
14619
14991
  source: 'api' | 'workflow' | 'automation';
14620
14992
  };
14621
14993
 
14622
- export type event18 = 'contact.field_changed';
14994
+ export type event21 = 'contact.field_changed';
14623
14995
 
14624
14996
  /**
14625
14997
  * Who wrote the field: the API or dashboard, a workflow set_field node, or an automation.
@@ -14651,7 +15023,7 @@ export type WebhookPayloadContactTag = {
14651
15023
  source: 'api' | 'workflow' | 'automation';
14652
15024
  };
14653
15025
 
14654
- export type event19 = 'contact.tag_added' | 'contact.tag_removed';
15026
+ export type event22 = 'contact.tag_added' | 'contact.tag_removed';
14655
15027
 
14656
15028
  /**
14657
15029
  * Who answers a conversation changed under Meta's handover protocol. WhatsApp: Meta
@@ -14697,7 +15069,7 @@ export type WebhookPayloadConversationControlChanged = {
14697
15069
  timestamp: string;
14698
15070
  };
14699
15071
 
14700
- export type event20 = 'conversation.control_changed';
15072
+ export type event23 = 'conversation.control_changed';
14701
15073
 
14702
15074
  /**
14703
15075
  * Who answers now. ai_agent: Meta Business Agent (WhatsApp); app: you; other: another app (a WhatsApp partner, or a Messenger / Instagram receiver such as Page Inbox).
@@ -14715,6 +15087,20 @@ export type previousOwner = 'app' | 'ai_agent' | 'other';
14715
15087
  * platform (Instagram, Messenger/Facebook, Telegram, WhatsApp, X, Reddit,
14716
15088
  * Bluesky, SMS, TikTok). Platform-agnostic: one subscription covers every DM platform.
14717
15089
  *
15090
+ * `conversation.metadata` (the referral as Meta sent it) and
15091
+ * `conversation.adAttribution` (the ad, campaign and ad set from your synced
15092
+ * ads) are filled only when the message that created the conversation carried
15093
+ * Meta's referral. That holds for WhatsApp Click-to-WhatsApp and Facebook
15094
+ * Messenger Click-to-Message, and for ig.me / m.me ref links. On Instagram
15095
+ * Click-to-Direct it usually does NOT: Meta creates the thread with the ad post
15096
+ * itself, an attachment-only `share` / `ig_post` message with no referral, and
15097
+ * attaches the referral to the next message. That conversation.started then
15098
+ * has `adAttribution` null and no `metadata`. Read the click from `metadata.ad`
15099
+ * and `metadata.referral` on the `message.received` that follows, or from
15100
+ * `adAttribution` on `GET /v1/inbox/conversations` and
15101
+ * `GET /v1/inbox/conversations/{conversationId}`, which carry it once the
15102
+ * referral is stored.
15103
+ *
14718
15104
  */
14719
15105
  export type WebhookPayloadConversationStarted = {
14720
15106
  /**
@@ -14727,7 +15113,10 @@ export type WebhookPayloadConversationStarted = {
14727
15113
  id: string;
14728
15114
  profiles?: WebhookProfiles;
14729
15115
  event: 'conversation.started';
14730
- conversation: InboxWebhookConversationDetail;
15116
+ conversation: (InboxWebhookConversationDetail & {
15117
+ metadata?: InboxConversationAdMetadata;
15118
+ adAttribution: ConversationAdAttribution;
15119
+ });
14731
15120
  account: InboxWebhookAccount;
14732
15121
  /**
14733
15122
  * When the conversation document was created.
@@ -14739,7 +15128,7 @@ export type WebhookPayloadConversationStarted = {
14739
15128
  timestamp: string;
14740
15129
  };
14741
15130
 
14742
- export type event21 = 'conversation.started';
15131
+ export type event24 = 'conversation.started';
14743
15132
 
14744
15133
  /**
14745
15134
  * Webhook payload for post.external.created / post.external.updated /
@@ -14776,7 +15165,7 @@ export type WebhookPayloadExternalPost = {
14776
15165
  timestamp: string;
14777
15166
  };
14778
15167
 
14779
- export type event22 = 'post.external.created' | 'post.external.updated' | 'post.external.deleted';
15168
+ export type event25 = 'post.external.created' | 'post.external.updated' | 'post.external.deleted';
14780
15169
 
14781
15170
  /**
14782
15171
  * Webhook payload for lead.received events (Meta Lead Gen / Instant Forms).
@@ -14852,7 +15241,7 @@ export type WebhookPayloadLead = {
14852
15241
  timestamp: string;
14853
15242
  };
14854
15243
 
14855
- export type event23 = 'lead.received';
15244
+ export type event26 = 'lead.received';
14856
15245
 
14857
15246
  export type platform16 = 'facebook';
14858
15247
 
@@ -15394,6 +15783,18 @@ export type WebhookPayloadMessage = {
15394
15783
  flow_id?: string;
15395
15784
  };
15396
15785
  } | null;
15786
+ /**
15787
+ * Present with `referral` whenever the referral is attributable: on
15788
+ * Instagram and Facebook every forwarded referral (an `ad_id` or a
15789
+ * `ref`), on WhatsApp a referral carrying `ctwa_clid`, `source_id`,
15790
+ * `source_url` or `headline`. The same click enriched from your
15791
+ * synced ads: the ad name, campaign, ad set and ad account Zernio
15792
+ * holds for this ad ID. Built from this message's referral, so it
15793
+ * follows a returning click, while the conversation's
15794
+ * `adAttribution` keeps the first one.
15795
+ *
15796
+ */
15797
+ ad?: (ConversationAdAttribution);
15397
15798
  /**
15398
15799
  * WhatsApp only. Meta's own reason this message has no
15399
15800
  * renderable body. Present when Meta attached an error to the
@@ -15443,7 +15844,7 @@ export type WebhookPayloadMessage = {
15443
15844
  timestamp: string;
15444
15845
  };
15445
15846
 
15446
- export type event24 = 'message.received';
15847
+ export type event27 = 'message.received';
15447
15848
 
15448
15849
  /**
15449
15850
  * Which Zernio surface produced the message. Always present and
@@ -15509,7 +15910,7 @@ export type WebhookPayloadMessageDeleted = {
15509
15910
  timestamp: string;
15510
15911
  };
15511
15912
 
15512
- export type event25 = 'message.deleted';
15913
+ export type event28 = 'message.deleted';
15513
15914
 
15514
15915
  /**
15515
15916
  * Shared payload for message.delivered, message.read, message.played and
@@ -15577,7 +15978,7 @@ export type WebhookPayloadMessageDeliveryStatus = {
15577
15978
  timestamp: string;
15578
15979
  };
15579
15980
 
15580
- export type event26 = 'message.delivered' | 'message.read' | 'message.played' | 'message.failed';
15981
+ export type event29 = 'message.delivered' | 'message.read' | 'message.played' | 'message.failed';
15581
15982
 
15582
15983
  /**
15583
15984
  * Webhook payload for message.edited events. Fires when the sender
@@ -15620,7 +16021,7 @@ export type WebhookPayloadMessageEdited = {
15620
16021
  timestamp: string;
15621
16022
  };
15622
16023
 
15623
- export type event27 = 'message.edited';
16024
+ export type event30 = 'message.edited';
15624
16025
 
15625
16026
  /**
15626
16027
  * Webhook payload for message sent events (fired when a message is sent via the API, or from the WhatsApp Business app on Coexistence numbers)
@@ -15866,7 +16267,7 @@ export type WebhookPayloadMessageSent = {
15866
16267
  timestamp: string;
15867
16268
  };
15868
16269
 
15869
- export type event28 = 'message.sent';
16270
+ export type event31 = 'message.sent';
15870
16271
 
15871
16272
  /**
15872
16273
  * Every platform whose outgoing messages Zernio observes. sms is absent on purpose: its carrier receipts update delivery status and never raise message.sent.
@@ -15924,7 +16325,7 @@ export type WebhookPayloadPhoneNumberStockAvailable = {
15924
16325
  timestamp: string;
15925
16326
  };
15926
16327
 
15927
- export type event29 = 'phone_number.stock_available';
16328
+ export type event32 = 'phone_number.stock_available';
15928
16329
 
15929
16330
  /**
15930
16331
  * Webhook payload for post events
@@ -15979,7 +16380,7 @@ export type WebhookPayloadPost = {
15979
16380
  timestamp: string;
15980
16381
  };
15981
16382
 
15982
- export type event30 = 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled';
16383
+ export type event33 = 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled';
15983
16384
 
15984
16385
  /**
15985
16386
  * Webhook payload for the per-platform terminal events
@@ -16103,7 +16504,7 @@ export type WebhookPayloadPostPlatform = {
16103
16504
  timestamp: string;
16104
16505
  };
16105
16506
 
16106
- export type event31 = 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved';
16507
+ export type event34 = 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved';
16107
16508
 
16108
16509
  /**
16109
16510
  * Terminal status this event fires on. Matches the event suffix.
@@ -16168,7 +16569,7 @@ export type WebhookPayloadReaction = {
16168
16569
  timestamp: string;
16169
16570
  };
16170
16571
 
16171
- export type event32 = 'reaction.received';
16572
+ export type event35 = 'reaction.received';
16172
16573
 
16173
16574
  export type action = 'added' | 'removed';
16174
16575
 
@@ -16247,7 +16648,7 @@ export type WebhookPayloadReferral = {
16247
16648
  timestamp: string;
16248
16649
  };
16249
16650
 
16250
- export type event33 = 'referral.received';
16651
+ export type event36 = 'referral.received';
16251
16652
 
16252
16653
  /**
16253
16654
  * Webhook payload for the review.new event (new review posted on a connected account).
@@ -16279,7 +16680,7 @@ export type WebhookPayloadReviewNew = {
16279
16680
  timestamp: string;
16280
16681
  };
16281
16682
 
16282
- export type event34 = 'review.new';
16683
+ export type event37 = 'review.new';
16283
16684
 
16284
16685
  /**
16285
16686
  * Webhook payload for the review.updated event. Fired when the reviewer edits their
@@ -16317,7 +16718,7 @@ export type WebhookPayloadReviewUpdated = {
16317
16718
  timestamp: string;
16318
16719
  };
16319
16720
 
16320
- export type event35 = 'review.updated';
16721
+ export type event38 = 'review.updated';
16321
16722
 
16322
16723
  export type WebhookPayloadSequenceEnrollment = {
16323
16724
  /**
@@ -16350,7 +16751,7 @@ export type WebhookPayloadSequenceEnrollment = {
16350
16751
  exitReason?: 'completed' | 'replied' | 'manual' | 'failed' | 'unsubscribed';
16351
16752
  };
16352
16753
 
16353
- export type event36 = 'sequence.enrolled' | 'sequence.exited';
16754
+ export type event39 = 'sequence.enrolled' | 'sequence.exited';
16354
16755
 
16355
16756
  /**
16356
16757
  * sequence.exited only. completed: the last step was sent; replied: the contact replied and the sequence exits on reply; manual: unenrolled through the API; failed: the step kept failing to send; unsubscribed: the contact opted out.
@@ -16371,7 +16772,7 @@ export type WebhookPayloadSupportRun = {
16371
16772
  run: SupportRun;
16372
16773
  };
16373
16774
 
16374
- export type event37 = 'support.run.completed' | 'support.run.failed';
16775
+ export type event40 = 'support.run.completed' | 'support.run.failed';
16375
16776
 
16376
16777
  /**
16377
16778
  * Webhook payload for test deliveries
@@ -16392,7 +16793,7 @@ export type WebhookPayloadTest = {
16392
16793
  timestamp: string;
16393
16794
  };
16394
16795
 
16395
- export type event38 = 'webhook.test';
16796
+ export type event41 = 'webhook.test';
16396
16797
 
16397
16798
  /**
16398
16799
  * Webhook payload for `whatsapp.account.alert_received`, forwarded from Meta's
@@ -16444,7 +16845,7 @@ export type WebhookPayloadWhatsAppAccountAlertReceived = {
16444
16845
  timestamp: string;
16445
16846
  };
16446
16847
 
16447
- export type event39 = 'whatsapp.account.alert_received';
16848
+ export type event42 = 'whatsapp.account.alert_received';
16448
16849
 
16449
16850
  export type platform18 = 'whatsapp';
16450
16851
 
@@ -16500,7 +16901,7 @@ export type WebhookPayloadWhatsAppAccountNameStatusUpdated = {
16500
16901
  timestamp: string;
16501
16902
  };
16502
16903
 
16503
- export type event40 = 'whatsapp.account.name_status_updated';
16904
+ export type event43 = 'whatsapp.account.name_status_updated';
16504
16905
 
16505
16906
  /**
16506
16907
  * Normalized from Meta's `decision` (REJECTED -> DECLINED, DEFERRED -> PENDING_REVIEW; the review is still open on DEFERRED, not a rejection).
@@ -16558,7 +16959,7 @@ export type WebhookPayloadWhatsAppAccountQualityUpdated = {
16558
16959
  timestamp: string;
16559
16960
  };
16560
16961
 
16561
- export type event41 = 'whatsapp.account.quality_updated';
16962
+ export type event44 = 'whatsapp.account.quality_updated';
16562
16963
 
16563
16964
  /**
16564
16965
  * The Meta webhook field that reported the change.
@@ -16634,7 +17035,7 @@ export type WebhookPayloadWhatsAppAccountStatusUpdated = {
16634
17035
  timestamp: string;
16635
17036
  };
16636
17037
 
16637
- export type event42 = 'whatsapp.account.status_updated';
17038
+ export type event45 = 'whatsapp.account.status_updated';
16638
17039
 
16639
17040
  /**
16640
17041
  * `active` only on a reinstatement (DISABLED_UPDATE with ban state REINSTATE).
@@ -16691,7 +17092,7 @@ export type WebhookPayloadWhatsAppContactIdentityChanged = {
16691
17092
  timestamp: string;
16692
17093
  };
16693
17094
 
16694
- export type event43 = 'whatsapp.contact.identity_changed';
17095
+ export type event46 = 'whatsapp.contact.identity_changed';
16695
17096
 
16696
17097
  /**
16697
17098
  * Which Meta signal reported the change. `user_changed_number`: new phone number. `user_changed_user_id` and `user_id_update`: new BSUID.
@@ -16765,7 +17166,7 @@ export type WebhookPayloadWhatsAppTemplateCategoryUpdated = {
16765
17166
  timestamp: string;
16766
17167
  };
16767
17168
 
16768
- export type event44 = 'whatsapp.template.category_updated';
17169
+ export type event47 = 'whatsapp.template.category_updated';
16769
17170
 
16770
17171
  /**
16771
17172
  * `scheduled` is Meta's 24h advance notice of an upcoming
@@ -16847,7 +17248,7 @@ export type WebhookPayloadWhatsAppTemplateStatusUpdated = {
16847
17248
  timestamp: string;
16848
17249
  };
16849
17250
 
16850
- export type event45 = 'whatsapp.template.status_updated';
17251
+ export type event48 = 'whatsapp.template.status_updated';
16851
17252
 
16852
17253
  /**
16853
17254
  * New status. Forwarded verbatim from Meta's `event` field.
@@ -16914,7 +17315,7 @@ export type WebhookPayloadWorkflowRun = {
16914
17315
  error?: string;
16915
17316
  };
16916
17317
 
16917
- export type event46 = 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed';
17318
+ export type event49 = 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed';
16918
17319
 
16919
17320
  /**
16920
17321
  * running on workflow.run.started; completed or exited (ended on purpose before the last node, e.g. a handoff) on workflow.run.completed; failed on workflow.run.failed.
@@ -17341,7 +17742,7 @@ export type WorkflowNode = {
17341
17742
  *
17342
17743
  * **trigger**: `{ triggerType: inbound_message|api_call|whatsapp_event|referral|story_mention|comment|reaction|lead_received, keywords:[string], matchType: any|contains|exact|regex, onlyFirstMessage:boolean, eventType: message_sent|message_delivered|message_read|message_failed|reaction, referral:{ ref, matchType: exact|prefix|any }, reaction:{ emojis:[string] }, comment:{ keywords:[string], matchType: any|contains|exact|regex, platformPostId }, leadReceived:{ formIds:[string], pageAccountIds:[string], consentCheckboxKey, defaultCountry, allowCrossProfile:boolean }, cooldownHours:int (1-720) }`. Default `triggerType` is `inbound_message` for legacy nodes. A workflow starts only on events of its own trigger type: `inbound_message` on a message, `referral` on an ig.me / m.me / click-to-message ad referral (standalone, or the first message carrying one; the two are deduplicated per conversation within 60 seconds), `story_mention` on an Instagram story mention, `reaction` on a reaction (Instagram, Facebook, WhatsApp, Telegram groups), `comment` on an Instagram or Facebook comment (the run starts with no conversation and its first `send_message`, which must be text (with optional buttons or quick replies) or cards and must follow the trigger directly (checked on save; on some Instagram accounts Meta refuses buttons and cards to commenters who do not follow the account), is sent as a private reply to the comment; the run then continues in the conversation that reply opens; when an active comment automation's keywords match the comment, the automation answers and the workflow does not start), `whatsapp_event` on a WhatsApp status of a message we sent (filtered by `eventType`), `api_call` only via `POST /v1/workflows/{workflowId}/trigger`, and `lead_received` (WhatsApp workflows only) when a Meta lead ad form is submitted. A `lead_received` trigger needs `leadReceived.consentCheckboxKey` and at least one of `formIds` or `pageAccountIds`; a form scope wins over a Page scope, then the earliest activated workflow. It starts only for leads submitted in the last hour and after the workflow was activated, whose consent checkbox (the form's custom disclaimer, see `POST /v1/ads/lead-forms`) is ticked, and whose phone number parses to a valid international number (`defaultCountry`, ISO 3166 alpha-2, defaults to the country of the workflow's WhatsApp number); otherwise the lead is marked `unreachable`. The Page and the WhatsApp number must be in the same profile unless `allowCrossProfile` is true. Every send or call reached first from the trigger must be a WhatsApp template (checked on save). `referral.matchType` defaults to `any`. `cooldownHours` (inbound_message, referral, story_mention, reaction, whatsapp_event and lead_received, where it defaults to 24) stops the same contact from starting the workflow again inside the window. A `whatsapp_event` workflow never starts on the status of a message a workflow, sequence or comment automation sent. A redelivered platform event never starts the same workflow twice.
17343
17744
  *
17344
- * **Variables** available from the start of every run (absent values are `''`): `lastMessage`, `inboundText`, `triggerText`, `conversationId`, `contact.name`, `contact.phone`, `contact.handle`, `contact.tags` (array), `contact.fields` (the contact's custom fields object), `contact.lastInteractionAt` (ISO date), `contact.lastInteractionHoursAgo` (number), `contact.isFollower` (Instagram, from the stored profile: true, false or `''` when unknown), `referral.ref`, `referral.source`, `referral.type`, `referral.adId`, `postback.payload`, `postback.title`, `quickReply.payload`, `quickReply.title`, `story.id`, `story.url`, `comment.id`, `comment.text`, `comment.platformPostId`, `reaction.emoji`, `reaction.action` (added|removed). `api_call` runs also get the request's `variables`, merged over these. `lead_received` runs also get `lead.id`, `lead.leadgenId`, `lead.formId`, `lead.formName`, `lead.adId`, `lead.adsetId`, `lead.campaignId` and every form answer by its key (`lead.full_name`, `lead.email`, `lead.phone_number`). Template `variableMapping` entries with `field: custom` interpolate `{{...}}` in `customValue`. An array or object interpolated into text renders as JSON.
17745
+ * **Variables** available from the start of every run (absent values are `''`): `lastMessage`, `inboundText`, `triggerText`, `conversationId`, `contact.name`, `contact.phone`, `contact.handle`, `contact.tags` (array), `contact.fields` (the contact's custom fields object), `contact.lastInteractionAt` (ISO date), `contact.lastInteractionHoursAgo` (number), `contact.isFollower` (Instagram, from the stored profile: true, false or `''` when unknown), `referral.ref`, `referral.source`, `referral.type`, `referral.adId`, `referral.adTitle` (the ad title or headline Meta sent), `referral.adName` (the synced ad's name, else `referral.adTitle`), `referral.campaignName` (the synced ad's campaign), `postback.payload`, `postback.title`, `quickReply.payload`, `quickReply.title`, `story.id`, `story.url`, `comment.id`, `comment.text`, `comment.platformPostId`, `reaction.emoji`, `reaction.action` (added|removed). `api_call` runs also get the request's `variables`, merged over these. `lead_received` runs also get `lead.id`, `lead.leadgenId`, `lead.formId`, `lead.formName`, `lead.adId`, `lead.adsetId`, `lead.campaignId` and every form answer by its key (`lead.full_name`, `lead.email`, `lead.phone_number`). Template `variableMapping` entries with `field: custom` interpolate `{{...}}` in `customValue`. An array or object interpolated into text renders as JSON.
17345
17746
  *
17346
17747
  * **send_message**: `{ messageType: text|template|media|interactive|cards, text, template, media:{mediaType:image|video|audio|document, url,caption}, interactive, buttons, quickReplies, messageTag }`. `template` is `{name,language,variableMapping}` for `messageType: template` and `{ type: generic, elements:[{ title, subtitle, imageUrl, buttons }] }` (1 to 10 cards) for `messageType: cards`. `template` and `interactive` are WhatsApp-only. `interactive.type` is inferred from the payload shape when omitted; payloads with neither `type` nor an inferable shape are rejected.
17347
17748
  * Facebook and Instagram only (rejected with a 400 on other platforms; WhatsApp keeps `interactive`): `cards`, plus `buttons` on `text` (cards carry their own buttons) and `quickReplies` / `messageTag` on `text`, `media` and `cards`. `media` takes no `buttons` (a 400 at save). `buttons:[{ type: url|postback|phone, title, url, payload, phone, workflowId }]` (1 to 3, text only and the text then 640 characters at most, sent as Meta's button_template, `phone` Facebook-only, not inside cards), `quickReplies:[{ title, payload, imageUrl, workflowId }]` (1 to 13, not combined with `buttons`) and `messageTag: HUMAN_AGENT|CONFIRMED_EVENT_UPDATE|POST_PURCHASE_UPDATE|ACCOUNT_UPDATE` (Instagram accepts only `HUMAN_AGENT`). Titles are capped at 20 characters (80 for card titles and subtitles). A postback button or quick reply with no `payload` gets `zernio:workflow:<this workflow id>`, so a tap answers this workflow's pending `wait_for_reply` or restarts it; with `workflowId` (a 24-hex workflow id, not combined with `payload`) the tap starts that workflow instead.
@@ -28657,7 +29058,7 @@ export type CreateWebhookSettingsData = {
28657
29058
  /**
28658
29059
  * Events to subscribe to (at least one required)
28659
29060
  */
28660
- events: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'conversation.started' | 'conversation.control_changed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'comment.received' | 'review.new' | 'review.updated' | 'lead.received' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.video.processed' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.automatic_event' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'verification.approved' | 'verification.failed' | 'api.changelog.published' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed')>;
29061
+ events: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'conversation.started' | 'conversation.control_changed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'comment.received' | 'review.new' | 'review.updated' | 'lead.received' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.delivery_issue' | 'campaign.budget.depleted' | 'ad_account.status_changed' | 'ad.video.processed' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.automatic_event' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'verification.approved' | 'verification.failed' | 'api.changelog.published' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed')>;
28661
29062
  /**
28662
29063
  * Enable or disable webhook delivery. Defaults to `true` when omitted.
28663
29064
  */
@@ -28723,7 +29124,7 @@ export type UpdateWebhookSettingsData = {
28723
29124
  /**
28724
29125
  * Events to subscribe to. Must contain at least one event if provided.
28725
29126
  */
28726
- events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'conversation.started' | 'conversation.control_changed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'comment.received' | 'review.new' | 'review.updated' | 'lead.received' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.video.processed' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.automatic_event' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'verification.approved' | 'verification.failed' | 'api.changelog.published' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed')>;
29127
+ events?: Array<('post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'conversation.started' | 'conversation.control_changed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'comment.received' | 'review.new' | 'review.updated' | 'lead.received' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.delivery_issue' | 'campaign.budget.depleted' | 'ad_account.status_changed' | 'ad.video.processed' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.automatic_event' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'verification.approved' | 'verification.failed' | 'api.changelog.published' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed')>;
28727
29128
  /**
28728
29129
  * Enable or disable webhook delivery
28729
29130
  */
@@ -28893,7 +29294,7 @@ export type TestWebhookData = {
28893
29294
  /**
28894
29295
  * Send a sample payload of this event instead of `webhook.test`. The sample is marked with `test: true`.
28895
29296
  */
28896
- event?: 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'conversation.started' | 'conversation.control_changed' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'comment.received' | 'review.new' | 'review.updated' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.video.processed' | 'lead.received' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.automatic_event' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'verification.approved' | 'verification.failed' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'api.changelog.published';
29297
+ event?: 'post.scheduled' | 'post.published' | 'post.failed' | 'post.partial' | 'post.cancelled' | 'post.recycled' | 'post.platform.published' | 'post.platform.failed' | 'post.platform.deleted' | 'post.tiktok.url_resolved' | 'post.external.created' | 'post.external.updated' | 'post.external.deleted' | 'account.connected' | 'account.disconnected' | 'account.ads.initial_sync_completed' | 'account.ads.sync_failed' | 'account.ads.sync_recovered' | 'analytics.synced' | 'message.received' | 'message.sent' | 'message.edited' | 'message.deleted' | 'message.delivered' | 'message.read' | 'message.played' | 'message.failed' | 'reaction.received' | 'referral.received' | 'conversation.started' | 'conversation.control_changed' | 'contact.tag_added' | 'contact.tag_removed' | 'contact.field_changed' | 'sequence.enrolled' | 'sequence.exited' | 'workflow.run.started' | 'workflow.run.completed' | 'workflow.run.failed' | 'support.run.completed' | 'support.run.failed' | 'call.received' | 'call.ended' | 'call.failed' | 'call.permission_request' | 'comment.received' | 'review.new' | 'review.updated' | 'ad.status_changed' | 'ad.review.approved' | 'ad.review.rejected' | 'ad.delivery_issue' | 'campaign.budget.depleted' | 'ad_account.status_changed' | 'ad.video.processed' | 'lead.received' | 'whatsapp.template.status_updated' | 'whatsapp.template.category_updated' | 'whatsapp.account.name_status_updated' | 'whatsapp.account.quality_updated' | 'whatsapp.account.status_updated' | 'whatsapp.account.alert_received' | 'whatsapp.contact.identity_changed' | 'whatsapp.number.activated' | 'whatsapp.number.declined' | 'whatsapp.number.action_required' | 'whatsapp.automatic_event' | 'whatsapp.number.verification_required' | 'whatsapp.number.suspended' | 'whatsapp.number.reactivated' | 'whatsapp.number.released' | 'whatsapp.number.kyc_submitted' | 'phone_number.stock_available' | 'sms.registration.action_required' | 'sms.registration.status_updated' | 'branded_calling.identity.status_updated' | 'branded_calling.identity.action_required' | 'branded_calling.number.status_updated' | 'rcs.agent.status_updated' | 'verification.approved' | 'verification.failed' | 'commerce.product.created' | 'commerce.product.updated' | 'commerce.product.deleted' | 'commerce.order.created' | 'commerce.order.updated' | 'commerce.order.refunded' | 'api.changelog.published';
28897
29298
  };
28898
29299
  };
28899
29300
 
@@ -29177,112 +29578,8 @@ export type ListInboxConversationsResponse = ({
29177
29578
  */
29178
29579
  fetchedAt?: (string) | null;
29179
29580
  } | null;
29180
- /**
29181
- * Click attribution for a conversation that started from a Meta ad or
29182
- * a ref-tagged ig.me / m.me link. Absent when the conversation did not
29183
- * originate from an attributable click.
29184
- *
29185
- * Captured from the referral Meta delivers for the click. If the same
29186
- * person later arrives through a different ad or link, the original
29187
- * values are kept, so the first referral wins; read the fresh referral
29188
- * per click on the `message.received` / `referral.received` webhooks
29189
- * instead. One exception on WhatsApp: when Meta omits `ctwa_clid`
29190
- * from that referral, a later Meta automatic event can supply it and
29191
- * refresh `ctwa_captured_at`, so treat `ctwa_captured_at` as the time
29192
- * Zernio stored the value, not the time of the click.
29193
- *
29194
- * Two families of keys, one per surface. They never appear together:
29195
- *
29196
- * - `ctwa_*` is WhatsApp Click-to-WhatsApp. The ad ID is
29197
- * `ctwa_source_id`. There is no `meta_ad_id` on WhatsApp.
29198
- * - `meta_ad_*` is Instagram Click-to-Direct, Facebook Messenger
29199
- * Click-to-Message, and ig.me / m.me ref links. The ad ID is
29200
- * `meta_ad_id` (ad clicks only; a link capture carries
29201
- * `meta_ad_ref` without it). `ctwa_clid` never appears on these
29202
- * platforms.
29203
- *
29204
- * Every key is optional and only the keys Meta supplied are returned, so
29205
- * read defensively. Meta does not send a campaign or ad set ID, so none
29206
- * is exposed here. More keys may be added over time. Treat any key you
29207
- * do not recognise as an opaque string.
29208
- *
29209
- * Key names differ from the `message.received` webhook on purpose. The
29210
- * webhook forwards Meta's referral verbatim (`ad_id`, `source`, `type`)
29211
- * while the stored conversation record uses the prefixed names below.
29212
- * Renaming either side would break existing integrations, so both
29213
- * spellings are kept.
29214
- *
29215
- */
29216
- metadata?: {
29217
- /**
29218
- * WhatsApp only. Meta's click identifier, the value to forward to the Meta Conversions API for Business Messaging. Meta omits it on some numbers, so a WhatsApp referral can arrive without it.
29219
- */
29220
- ctwa_clid?: string;
29221
- /**
29222
- * WhatsApp only. The Meta ad ID the user clicked. This is the WhatsApp equivalent of meta_ad_id.
29223
- */
29224
- ctwa_source_id?: string;
29225
- /**
29226
- * WhatsApp only. What the user clicked, as supplied by Meta (for example ad or post).
29227
- */
29228
- ctwa_source_type?: string;
29229
- /**
29230
- * WhatsApp only. Meta's URL for the ad that was clicked, normally an fb.me short link.
29231
- */
29232
- ctwa_source_url?: string;
29233
- /**
29234
- * WhatsApp only. Headline of the ad creative at click time.
29235
- */
29236
- ctwa_headline?: string;
29237
- /**
29238
- * WhatsApp only. When Zernio stored this referral. Always present when a WhatsApp referral was captured.
29239
- */
29240
- ctwa_captured_at?: string;
29241
- /**
29242
- * Instagram and Facebook only. The Meta ad ID the user clicked. Present for ad clicks; absent when the capture came from an ig.me / m.me ref link.
29243
- */
29244
- meta_ad_id?: string;
29245
- /**
29246
- * Instagram and Facebook only. Meta-supplied source identifier: ADS for ad clicks; SHORTLINK, SHORTLINKS or IGME-SOURCE-LINK for ref links (treat as opaque).
29247
- */
29248
- meta_ad_source?: string;
29249
- /**
29250
- * Instagram and Facebook only. Meta-supplied referral type, for example OPEN_THREAD.
29251
- */
29252
- meta_ad_type?: string;
29253
- /**
29254
- * Instagram and Facebook only. The ref parameter passed through from the ad creative or the ig.me / m.me link.
29255
- */
29256
- meta_ad_ref?: string;
29257
- /**
29258
- * Instagram and Facebook only. Title of the ad creative at click time.
29259
- */
29260
- meta_ad_title?: string;
29261
- /**
29262
- * Instagram and Facebook only. Image of the ad creative at click time.
29263
- */
29264
- meta_ad_photo_url?: string;
29265
- /**
29266
- * Instagram and Facebook only. Video of the ad creative at click time.
29267
- */
29268
- meta_ad_video_url?: string;
29269
- /**
29270
- * Instagram and Facebook only. The organic post the ad promoted, when the ad was a boosted post.
29271
- */
29272
- meta_ad_post_id?: string;
29273
- /**
29274
- * Instagram and Facebook only. The catalogue product the user clicked, for product ads.
29275
- */
29276
- meta_ad_product_id?: string;
29277
- /**
29278
- * Instagram and Facebook only. The Meta flow the ad launched, for flow ads.
29279
- */
29280
- meta_ad_flow_id?: string;
29281
- /**
29282
- * Instagram and Facebook only. When Zernio stored this referral. Always present when an Instagram or Facebook referral was captured.
29283
- */
29284
- meta_ad_captured_at?: string;
29285
- } | null;
29581
+ metadata?: InboxConversationAdMetadata;
29582
+ adAttribution?: ConversationAdAttribution;
29286
29583
  }>;
29287
29584
  pagination?: {
29288
29585
  hasMore?: boolean;
@@ -29680,81 +29977,8 @@ export type GetInboxConversationResponse = ({
29680
29977
  */
29681
29978
  fetchedAt?: (string) | null;
29682
29979
  } | null;
29683
- /**
29684
- * Ad-click attribution for a conversation that started from a Meta ad.
29685
- * Absent when the conversation did not originate from an ad click.
29686
- *
29687
- * Captured once, from the first inbound message Meta attaches the referral
29688
- * to, and never overwritten. If the same person later clicks a different
29689
- * ad, the original values are kept. On Instagram Click-to-Direct that is
29690
- * usually not the first message: Meta first delivers the ad post as an
29691
- * attachment-only `share` / `ig_post` message with no referral, then
29692
- * attaches the referral to the next message.
29693
- *
29694
- * This operation currently returns only the `meta_ad_*` family, which
29695
- * covers Instagram Click-to-Direct and Facebook Messenger
29696
- * Click-to-Message. WhatsApp Click-to-WhatsApp attribution (the `ctwa_*`
29697
- * keys, where the ad ID is `ctwa_source_id`) is returned by
29698
- * `GET /v1/inbox/conversations` instead.
29699
- *
29700
- * Every key is optional and only the keys Meta supplied are returned, so
29701
- * read defensively. Meta does not send a campaign or ad set ID, so none is
29702
- * exposed here. More keys may be added over time. Treat any key you do not
29703
- * recognise as an opaque string.
29704
- *
29705
- * Key names differ from the `message.received` webhook on purpose. The
29706
- * webhook forwards Meta's referral verbatim (`ad_id`, `source`, `type`)
29707
- * while the stored conversation record uses the prefixed names below.
29708
- * Renaming either side would break existing integrations, so both
29709
- * spellings are kept.
29710
- *
29711
- */
29712
- metadata?: {
29713
- /**
29714
- * The Meta ad ID the user clicked. Always present when a referral was captured.
29715
- */
29716
- meta_ad_id?: string;
29717
- /**
29718
- * Meta-supplied source identifier, for example ADS.
29719
- */
29720
- meta_ad_source?: string;
29721
- /**
29722
- * Meta-supplied referral type, for example OPEN_THREAD.
29723
- */
29724
- meta_ad_type?: string;
29725
- /**
29726
- * The ref parameter passed through from the ad creative.
29727
- */
29728
- meta_ad_ref?: string;
29729
- /**
29730
- * Title of the ad creative at click time.
29731
- */
29732
- meta_ad_title?: string;
29733
- /**
29734
- * Image of the ad creative at click time.
29735
- */
29736
- meta_ad_photo_url?: string;
29737
- /**
29738
- * Video of the ad creative at click time.
29739
- */
29740
- meta_ad_video_url?: string;
29741
- /**
29742
- * The organic post the ad promoted, when the ad was a boosted post.
29743
- */
29744
- meta_ad_post_id?: string;
29745
- /**
29746
- * The catalogue product the user clicked, for product ads.
29747
- */
29748
- meta_ad_product_id?: string;
29749
- /**
29750
- * The Meta flow the ad launched, for flow ads.
29751
- */
29752
- meta_ad_flow_id?: string;
29753
- /**
29754
- * When Zernio stored this referral. Always present when a referral was captured.
29755
- */
29756
- meta_ad_captured_at?: string;
29757
- } | null;
29980
+ metadata?: InboxConversationAdMetadata;
29981
+ adAttribution?: ConversationAdAttribution;
29758
29982
  };
29759
29983
  });
29760
29984