/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.597.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// InboxConversationAdMetadata : Click attribution for a conversation that started from a Meta ad or a ref-tagged ig.me / m.me link, as Meta sent it. Absent when the conversation did not come from an attributable click. For the ad name, campaign and ad set, read `adAttribution`. **First referral wins.** Values come from the referral Meta delivers for the click. If the same person later arrives through another ad or link, the original values are kept. For the fresh referral per click, read the `message.received` / `referral.received` webhooks. On Instagram Click-to-Direct, Meta usually delivers the ad post first as an attachment-only `share` / `ig_post` message with no referral, then attaches the referral to the next message. WhatsApp exception: when Meta omits `ctwa_clid` from the referral, a later Meta automatic event can supply it and refresh `ctwa_captured_at`. Treat `ctwa_captured_at` as when Zernio stored the value, not when the click happened. **Two key families, one per surface, never together:** - `ctwa_*`: WhatsApp Click-to-WhatsApp. The ad ID is `ctwa_source_id`. There is no `meta_ad_id` on WhatsApp. - `meta_ad_*`: Instagram Click-to-Direct, Facebook Messenger Click-to-Message, and ig.me / m.me ref links. The ad ID is `meta_ad_id` (ad clicks only; a link capture carries `meta_ad_ref` without it). `ctwa_clid` never appears here. Every key is optional and only keys Meta supplied are returned, so read defensively. Meta sends no campaign or ad set ID; those are resolved from your synced ads in `adAttribution`. More keys may be added; treat unknown keys as opaque strings. Key names differ from the `message.received` webhook on purpose. The webhook forwards Meta's referral verbatim (`ad_id`, `source`, `type`), while the stored conversation uses the prefixed names. Renaming either side would break existing integrations, so both spellings stay.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct InboxConversationAdMetadata {
/// 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.
#[serde(rename = "ctwa_clid", skip_serializing_if = "Option::is_none")]
pub ctwa_clid: Option<String>,
/// 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.
#[serde(rename = "ctwa_source_id", skip_serializing_if = "Option::is_none")]
pub ctwa_source_id: Option<String>,
/// WhatsApp only. What the user clicked, as supplied by Meta (for example ad or post).
#[serde(rename = "ctwa_source_type", skip_serializing_if = "Option::is_none")]
pub ctwa_source_type: Option<String>,
/// WhatsApp only. Meta's URL for the ad that was clicked, normally an fb.me short link.
#[serde(rename = "ctwa_source_url", skip_serializing_if = "Option::is_none")]
pub ctwa_source_url: Option<String>,
/// WhatsApp only. Headline of the ad creative at click time.
#[serde(rename = "ctwa_headline", skip_serializing_if = "Option::is_none")]
pub ctwa_headline: Option<String>,
/// WhatsApp only. Body text of the ad creative at click time.
#[serde(rename = "ctwa_body", skip_serializing_if = "Option::is_none")]
pub ctwa_body: Option<String>,
/// WhatsApp only. Media type of the ad creative, image or video.
#[serde(rename = "ctwa_media_type", skip_serializing_if = "Option::is_none")]
pub ctwa_media_type: Option<String>,
/// WhatsApp only. Image of the ad creative at click time (image ads).
#[serde(rename = "ctwa_image_url", skip_serializing_if = "Option::is_none")]
pub ctwa_image_url: Option<String>,
/// WhatsApp only. Video of the ad creative at click time (video ads).
#[serde(rename = "ctwa_video_url", skip_serializing_if = "Option::is_none")]
pub ctwa_video_url: Option<String>,
/// WhatsApp only. Thumbnail of the ad video at click time (video ads).
#[serde(rename = "ctwa_thumbnail_url", skip_serializing_if = "Option::is_none")]
pub ctwa_thumbnail_url: Option<String>,
/// WhatsApp only. When Zernio stored this referral. Always present when a WhatsApp referral was captured.
#[serde(rename = "ctwa_captured_at", skip_serializing_if = "Option::is_none")]
pub ctwa_captured_at: Option<String>,
/// 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.
#[serde(rename = "meta_ad_id", skip_serializing_if = "Option::is_none")]
pub meta_ad_id: Option<String>,
/// Instagram and Facebook only. Meta-supplied source identifier: ADS for ad clicks; SHORTLINK, SHORTLINKS or IGME-SOURCE-LINK for ref links (treat as opaque).
#[serde(rename = "meta_ad_source", skip_serializing_if = "Option::is_none")]
pub meta_ad_source: Option<String>,
/// Instagram and Facebook only. Meta-supplied referral type, for example OPEN_THREAD.
#[serde(rename = "meta_ad_type", skip_serializing_if = "Option::is_none")]
pub meta_ad_type: Option<String>,
/// Instagram and Facebook only. The ref parameter passed through from the ad creative or the ig.me / m.me link.
#[serde(rename = "meta_ad_ref", skip_serializing_if = "Option::is_none")]
pub meta_ad_ref: Option<String>,
/// Instagram and Facebook only. Title of the ad creative at click time.
#[serde(rename = "meta_ad_title", skip_serializing_if = "Option::is_none")]
pub meta_ad_title: Option<String>,
/// Instagram and Facebook only. Image of the ad creative at click time.
#[serde(rename = "meta_ad_photo_url", skip_serializing_if = "Option::is_none")]
pub meta_ad_photo_url: Option<String>,
/// Instagram and Facebook only. Video of the ad creative at click time.
#[serde(rename = "meta_ad_video_url", skip_serializing_if = "Option::is_none")]
pub meta_ad_video_url: Option<String>,
/// Instagram and Facebook only. The organic post the ad promoted, when the ad was a boosted post.
#[serde(rename = "meta_ad_post_id", skip_serializing_if = "Option::is_none")]
pub meta_ad_post_id: Option<String>,
/// Instagram and Facebook only. The catalogue product the user clicked, for product ads.
#[serde(rename = "meta_ad_product_id", skip_serializing_if = "Option::is_none")]
pub meta_ad_product_id: Option<String>,
/// Instagram and Facebook only. The Meta flow the ad launched, for flow ads.
#[serde(rename = "meta_ad_flow_id", skip_serializing_if = "Option::is_none")]
pub meta_ad_flow_id: Option<String>,
/// Instagram and Facebook only. When Zernio stored this referral. Always present when an Instagram or Facebook referral was captured.
#[serde(
rename = "meta_ad_captured_at",
skip_serializing_if = "Option::is_none"
)]
pub meta_ad_captured_at: Option<String>,
}
impl InboxConversationAdMetadata {
/// Click attribution for a conversation that started from a Meta ad or a ref-tagged ig.me / m.me link, as Meta sent it. Absent when the conversation did not come from an attributable click. For the ad name, campaign and ad set, read `adAttribution`. **First referral wins.** Values come from the referral Meta delivers for the click. If the same person later arrives through another ad or link, the original values are kept. For the fresh referral per click, read the `message.received` / `referral.received` webhooks. On Instagram Click-to-Direct, Meta usually delivers the ad post first as an attachment-only `share` / `ig_post` message with no referral, then attaches the referral to the next message. WhatsApp exception: when Meta omits `ctwa_clid` from the referral, a later Meta automatic event can supply it and refresh `ctwa_captured_at`. Treat `ctwa_captured_at` as when Zernio stored the value, not when the click happened. **Two key families, one per surface, never together:** - `ctwa_*`: WhatsApp Click-to-WhatsApp. The ad ID is `ctwa_source_id`. There is no `meta_ad_id` on WhatsApp. - `meta_ad_*`: Instagram Click-to-Direct, Facebook Messenger Click-to-Message, and ig.me / m.me ref links. The ad ID is `meta_ad_id` (ad clicks only; a link capture carries `meta_ad_ref` without it). `ctwa_clid` never appears here. Every key is optional and only keys Meta supplied are returned, so read defensively. Meta sends no campaign or ad set ID; those are resolved from your synced ads in `adAttribution`. More keys may be added; treat unknown keys as opaque strings. Key names differ from the `message.received` webhook on purpose. The webhook forwards Meta's referral verbatim (`ad_id`, `source`, `type`), while the stored conversation uses the prefixed names. Renaming either side would break existing integrations, so both spellings stay.
pub fn new() -> InboxConversationAdMetadata {
InboxConversationAdMetadata {
ctwa_clid: None,
ctwa_source_id: None,
ctwa_source_type: None,
ctwa_source_url: None,
ctwa_headline: None,
ctwa_body: None,
ctwa_media_type: None,
ctwa_image_url: None,
ctwa_video_url: None,
ctwa_thumbnail_url: None,
ctwa_captured_at: None,
meta_ad_id: None,
meta_ad_source: None,
meta_ad_type: None,
meta_ad_ref: None,
meta_ad_title: None,
meta_ad_photo_url: None,
meta_ad_video_url: None,
meta_ad_post_id: None,
meta_ad_product_id: None,
meta_ad_flow_id: None,
meta_ad_captured_at: None,
}
}
}