/*
* 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.85.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct InboxWebhookMessageSender {
/// Sender's platform identifier. For WhatsApp this is the phone number (without leading `+`) when available, otherwise the `businessScopedUserId`. For other platforms, the platform's own user ID.
#[serde(rename = "id")]
pub id: String,
/// Zernio CRM Contact id for this sender, when one exists (joined via the ContactChannel mapping). Lets integrators link a message straight to a Contact without a follow-up Contacts API call. Omitted when the sender isn't a tracked contact (e.g. outgoing messages where the sender is the business, or first-touch messages before the contact is created).
#[serde(rename = "contactId", skip_serializing_if = "Option::is_none")]
pub contact_id: Option<String>,
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(rename = "username", skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[serde(rename = "picture", skip_serializing_if = "Option::is_none")]
pub picture: Option<String>,
/// WhatsApp only. Sender's phone number in E.164 format (with leading `+`). **Nullable during the BSUID rollout (April 2026+).** WhatsApp users who adopt a username can message businesses without exposing a phone number, so this field is omitted for them. Match by `businessScopedUserId` instead. See `docs/whatsapp-bsuid-migration.md`.
#[serde(
rename = "phoneNumber",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub phone_number: Option<Option<String>>,
/// WhatsApp only. Business-scoped user ID (BSUID), Meta's canonical identifier for a WhatsApp user within your business. Present when Meta includes it in the inbound payload (rollout in progress since early April 2026). **Recommended primary identity anchor** going forward; fall back to `phoneNumber` only when this field is absent.
#[serde(
rename = "businessScopedUserId",
skip_serializing_if = "Option::is_none"
)]
pub business_scoped_user_id: Option<String>,
/// WhatsApp only. Parent BSUID for businesses with linked business portfolios. Omitted for standalone portfolios.
#[serde(
rename = "parentBusinessScopedUserId",
skip_serializing_if = "Option::is_none"
)]
pub parent_business_scoped_user_id: Option<String>,
/// WhatsApp only. User's WhatsApp username (e.g. `@jane`). Not a stable identifier, because users can change it. Useful for display, not recommended as an identity anchor.
#[serde(rename = "whatsappUsername", skip_serializing_if = "Option::is_none")]
pub whatsapp_username: Option<String>,
#[serde(rename = "instagramProfile", skip_serializing_if = "Option::is_none")]
pub instagram_profile: Option<Box<models::InboxWebhookMessageSenderInstagramProfile>>,
}
impl InboxWebhookMessageSender {
pub fn new(id: String) -> InboxWebhookMessageSender {
InboxWebhookMessageSender {
id,
contact_id: None,
name: None,
username: None,
picture: None,
phone_number: None,
business_scoped_user_id: None,
parent_business_scoped_user_id: None,
whatsapp_username: None,
instagram_profile: None,
}
}
}