/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
*
* The version of the OpenAPI document: 1.0.4
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// SendInboxMessageRequestInteractive : WhatsApp-only. Rich interactive payload for list messages, CTA URL buttons, Flow prompts, and location requests. When set, takes priority over `buttons` and `quickReplies`. The shape mirrors Meta's Cloud API `interactive` object verbatim, so any payload that works against Meta directly will also work here. Use `buttons` / `quickReplies` for simple button replies (WhatsApp's `interactive.type: \"button\"`) — the abstraction caps at 3 buttons and handles the auto-conversion for you. Use this field only for `list`, `cta_url`, `flow`, `location_request_message`, or `voice_call` messages. For `voice_call`, the message renders WhatsApp's native call button; tapping it starts a voice call to your business number. Requires WhatsApp Business Calling to be enabled on the sending number. The optional `parameters.payload` string is echoed back on the `calls` webhook (as `cta_payload`) for attribution. For `location_request_message`, `action` may be omitted (we default it to `{ \"name\": \"send_location\" }`). WhatsApp renders a localized \"Send location\" button; the user's reply arrives as a regular location message in the conversation. Tap events come back via the `message.received` webhook with `metadata.interactiveType` set to `list_reply` or `nfm_reply`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SendInboxMessageRequestInteractive {
/// Which interactive layout to render.
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "header", skip_serializing_if = "Option::is_none")]
pub header: Option<Box<models::SendInboxMessageRequestInteractiveHeader>>,
#[serde(rename = "body")]
pub body: Box<models::SendInboxMessageRequestInteractiveBody>,
#[serde(rename = "footer", skip_serializing_if = "Option::is_none")]
pub footer: Option<Box<models::SendInboxMessageRequestInteractiveFooter>>,
#[serde(rename = "action", skip_serializing_if = "Option::is_none")]
pub action: Option<Box<models::SendInboxMessageRequestInteractiveAction>>,
}
impl SendInboxMessageRequestInteractive {
/// WhatsApp-only. Rich interactive payload for list messages, CTA URL buttons, Flow prompts, and location requests. When set, takes priority over `buttons` and `quickReplies`. The shape mirrors Meta's Cloud API `interactive` object verbatim, so any payload that works against Meta directly will also work here. Use `buttons` / `quickReplies` for simple button replies (WhatsApp's `interactive.type: \"button\"`) — the abstraction caps at 3 buttons and handles the auto-conversion for you. Use this field only for `list`, `cta_url`, `flow`, `location_request_message`, or `voice_call` messages. For `voice_call`, the message renders WhatsApp's native call button; tapping it starts a voice call to your business number. Requires WhatsApp Business Calling to be enabled on the sending number. The optional `parameters.payload` string is echoed back on the `calls` webhook (as `cta_payload`) for attribution. For `location_request_message`, `action` may be omitted (we default it to `{ \"name\": \"send_location\" }`). WhatsApp renders a localized \"Send location\" button; the user's reply arrives as a regular location message in the conversation. Tap events come back via the `message.received` webhook with `metadata.interactiveType` set to `list_reply` or `nfm_reply`.
pub fn new(
r#type: Type,
body: models::SendInboxMessageRequestInteractiveBody,
) -> SendInboxMessageRequestInteractive {
SendInboxMessageRequestInteractive {
r#type,
header: None,
body: Box::new(body),
footer: None,
action: None,
}
}
}
/// Which interactive layout to render.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "list")]
List,
#[serde(rename = "cta_url")]
CtaUrl,
#[serde(rename = "flow")]
Flow,
#[serde(rename = "location_request_message")]
LocationRequestMessage,
#[serde(rename = "voice_call")]
VoiceCall,
}
impl Default for Type {
fn default() -> Type {
Self::List
}
}