1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* 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.1
* 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 CreateWhatsAppTemplateRequest {
/// WhatsApp social account ID
#[serde(rename = "accountId")]
pub account_id: String,
/// Template name (lowercase, letters/numbers/underscores, must start with a letter)
#[serde(rename = "name")]
pub name: String,
/// Template category
#[serde(rename = "category")]
pub category: Category,
/// Template language code (e.g., en_US)
#[serde(rename = "language")]
pub language: String,
/// Template components (header, body, footer, buttons). Required for custom templates, omit when using library_template_name.
#[serde(rename = "components", skip_serializing_if = "Option::is_none")]
pub components: Option<Vec<models::WhatsAppTemplateComponent>>,
/// Name of a pre-built template from Meta's template library (e.g., \"appointment_reminder\", \"auto_pay_reminder_1\", \"address_update\"). When provided, the template is pre-approved by Meta with no review wait. Omit `components` when using this field.
#[serde(
rename = "library_template_name",
skip_serializing_if = "Option::is_none"
)]
pub library_template_name: Option<String>,
/// Optional body customizations for library templates. Available options depend on the template (e.g., add_contact_number, add_learn_more_link, add_security_recommendation, add_track_package_link, code_expiration_minutes).
#[serde(
rename = "library_template_body_inputs",
skip_serializing_if = "Option::is_none"
)]
pub library_template_body_inputs: Option<serde_json::Value>,
/// Optional button customizations for library templates. Each item specifies button type and configuration (e.g., URL, phone number, quick reply).
#[serde(
rename = "library_template_button_inputs",
skip_serializing_if = "Option::is_none"
)]
pub library_template_button_inputs:
Option<Vec<models::CreateWhatsAppTemplateRequestLibraryTemplateButtonInputsInner>>,
}
impl CreateWhatsAppTemplateRequest {
pub fn new(
account_id: String,
name: String,
category: Category,
language: String,
) -> CreateWhatsAppTemplateRequest {
CreateWhatsAppTemplateRequest {
account_id,
name,
category,
language,
components: None,
library_template_name: None,
library_template_body_inputs: None,
library_template_button_inputs: None,
}
}
}
/// Template category
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
#[serde(rename = "AUTHENTICATION")]
Authentication,
#[serde(rename = "MARKETING")]
Marketing,
#[serde(rename = "UTILITY")]
Utility,
}
impl Default for Category {
fn default() -> Category {
Self::Authentication
}
}