/*
* 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.563.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// ConversionEventMessaging : Meta only, read when `actionSource` is `business_messaging` (Conversions API for Business Messaging). - `channel` is sent as the event's `messaging_channel` (`instagram_direct` goes out as `instagram`). - Each id lands in Meta's `user_data` unhashed. An id that does not belong to `channel` is ignored. Meta accepts only its business messaging event names here: `LeadSubmitted`, `QualifiedLead`, `Purchase`, `AddToCart`, `InitiateCheckout`, `ViewContent`, `OrderCreated`, `OrderShipped`, `OrderDelivered`, `OrderCanceled`, `OrderReturned`, `CartAbandoned`, `RatingProvided`, `ReviewProvided`. `eventName` is forwarded unchanged.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ConversionEventMessaging {
#[serde(rename = "channel")]
pub channel: Channel,
/// WhatsApp only. WhatsApp Business Account id, sent as `whatsapp_business_account_id`.
#[serde(rename = "wabaId", skip_serializing_if = "Option::is_none")]
pub waba_id: Option<String>,
/// WhatsApp only. Click-to-WhatsApp click id from the first inbound message referral, sent as `ctwa_clid`.
#[serde(rename = "ctwaClid", skip_serializing_if = "Option::is_none")]
pub ctwa_clid: Option<String>,
/// Messenger: Facebook Page id, sent as `page_id`. Instagram Direct: when `instagramBusinessAccountId` is absent, Zernio reads the Instagram professional account linked to this Page and sends its id as `ig_account_id`; if none is linked or the lookup fails, `page_id` is sent instead.
#[serde(rename = "pageId", skip_serializing_if = "Option::is_none")]
pub page_id: Option<String>,
/// Instagram Direct only. Instagram professional account id (`instagram_business_account` on the Page), sent as `ig_account_id` next to `ig_sid`.
#[serde(
rename = "instagramBusinessAccountId",
skip_serializing_if = "Option::is_none"
)]
pub instagram_business_account_id: Option<String>,
/// Messenger only. The page-scoped user id (PSID) your Messenger webhook gives for the person, sent as `page_scoped_user_id` next to `page_id`.
#[serde(rename = "pageScopedUserId", skip_serializing_if = "Option::is_none")]
pub page_scoped_user_id: Option<String>,
/// Instagram Direct only. The Instagram-scoped user id (IGSID) your Instagram messaging webhook gives for the person, sent as `ig_sid`.
#[serde(
rename = "instagramScopedUserId",
skip_serializing_if = "Option::is_none"
)]
pub instagram_scoped_user_id: Option<String>,
}
impl ConversionEventMessaging {
/// Meta only, read when `actionSource` is `business_messaging` (Conversions API for Business Messaging). - `channel` is sent as the event's `messaging_channel` (`instagram_direct` goes out as `instagram`). - Each id lands in Meta's `user_data` unhashed. An id that does not belong to `channel` is ignored. Meta accepts only its business messaging event names here: `LeadSubmitted`, `QualifiedLead`, `Purchase`, `AddToCart`, `InitiateCheckout`, `ViewContent`, `OrderCreated`, `OrderShipped`, `OrderDelivered`, `OrderCanceled`, `OrderReturned`, `CartAbandoned`, `RatingProvided`, `ReviewProvided`. `eventName` is forwarded unchanged.
pub fn new(channel: Channel) -> ConversionEventMessaging {
ConversionEventMessaging {
channel,
waba_id: None,
ctwa_clid: None,
page_id: None,
instagram_business_account_id: None,
page_scoped_user_id: None,
instagram_scoped_user_id: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Channel {
#[serde(rename = "whatsapp")]
Whatsapp,
#[serde(rename = "messenger")]
Messenger,
#[serde(rename = "instagram_direct")]
InstagramDirect,
}
impl Default for Channel {
fn default() -> Channel {
Self::Whatsapp
}
}