import "github.com/gTahidi/wapi.go/manager"type AccountAlertSeverityEnum stringconst (
AccountAlertSeverityEnumCritical AccountAlertSeverityEnum = "CRITICAL"
AccountAlertSeverityEnumWarning AccountAlertSeverityEnum = "WARNING"
)type AccountAlertsValue struct {
EntityType string `json:"entity_type"`
EntityId string `json:"entity_id"`
AlertSeverity AccountAlertSeverityEnum `json:"alert_severity"`
AlertStatus string `json:"alert_status"`
AlertType string `json:"alert_type"`
AlertDescription string `json:"alert_description"`
}type AccountReviewUpdateValue struct {
Decision string `json:"decision"`
}type AccountUpdateBanInfo struct {
WabaBanState []string `json:"waba_ban_state"`
WabaBanDate string `json:"waba_ban_date"`
}type AccountUpdateEventEnum stringconst (
AccountUpdateEventEnumVerifiedAccount AccountUpdateEventEnum = "VERIFIED_ACCOUNT"
AccountUpdateEventEnumDisabledAccount AccountUpdateEventEnum = "DISABLED_UPDATE"
AccountUpdateEventEnumAccountViolation AccountUpdateEventEnum = "ACCOUNT_VIOLATION"
AccountUpdateEventEnumAccountRestriction AccountUpdateEventEnum = "ACCOUNT_RESTRICTION"
AccountUpdateEventEnumAccountDeleted AccountUpdateEventEnum = "ACCOUNT_DELETED"
AccountUpdateEventEnumPartnerRemoved AccountUpdateEventEnum = "PARTNER_REMOVED"
)type AccountUpdateRestrictionInfo struct {
RestrictionType string `json:"restriction_type"`
Expiration string `json:"expiration"`
}type AccountUpdateValue struct {
PhoneNumber string `json:"phone_number,omitempty"`
Event AccountUpdateEventEnum `json:"event"`
}type AccountUpdateViolationInfo struct {
ViolationType string `json:"violation_type"`
}type AdInteractionSourceMediaTypeEnum stringconst (
AdInteractionSourceMediaTypeImage AdInteractionSourceMediaTypeEnum = "image"
AdInteractionSourceMediaTypeVideo AdInteractionSourceMediaTypeEnum = "video"
)type AdInteractionSourceTypeEnum stringconst (
AdInteractionSourceTypeUnknown AdInteractionSourceTypeEnum = "unknown"
)type Applinks struct {
Web WebApplink `json:"web"`
}type BusinessCapabilityUpdateValue struct {
MaxDailyConversationPerPhone int `json:"max_daily_conversation_per_phone"`
MaxPhoneNumbersPerBusiness int `json:"max_phone_numbers_per_business"`
}type CapabilityReview struct {
Key string `json:"key"`
Value string `json:"value"`
}Update Catalog to use []ProductItem for Products.
type Catalog struct {
// Basic fields
Id string `json:"id"`
Name string `json:"name"`
ProductCount int `json:"product_count"`
Vertical string `json:"vertical,omitempty"`
// Edge relationships (represented as slices for brevity)
Agencies *[]interface{} `json:"agencies,omitempty"`
AssignedUsers *[]interface{} `json:"assigned_users,omitempty"`
AutomotiveModels *[]interface{} `json:"automotive_models,omitempty"`
Categories *[]interface{} `json:"categories,omitempty"`
CheckBatchRequestStatus *[]interface{} `json:"check_batch_request_status,omitempty"`
CollaborativeAdsShareSettings *[]interface{} `json:"collaborative_ads_share_settings,omitempty"`
DataSources *interface{} `json:"data_sources,omitempty"`
Destinations *[]interface{} `json:"destinations,omitempty"`
Diagnostics *[]interface{} `json:"diagnostics,omitempty"`
EventStats *[]interface{} `json:"event_stats,omitempty"`
ExternalEventSources *[]interface{} `json:"external_event_sources,omitempty"`
Flights *[]interface{} `json:"flights,omitempty"`
HomeListings *[]interface{} `json:"home_listings,omitempty"`
HotelRoomsBatch *[]interface{} `json:"hotel_rooms_batch,omitempty"`
Hotels *[]interface{} `json:"hotels,omitempty"`
PricingVariablesBatch *[]interface{} `json:"pricing_variables_batch,omitempty"`
ProductGroups *interface{} `json:"product_groups,omitempty"`
ProductSets *interface{} `json:"product_sets,omitempty"`
ProductSetsBatch *[]interface{} `json:"product_sets_batch,omitempty"`
Products struct {
Data []ProductItem `json:"data"`
} `json:"products,omitempty"`
VehicleOffers *[]interface{} `json:"vehicle_offers,omitempty"`
Vehicles *[]interface{} `json:"vehicles,omitempty"`
}type CatalogFetchResponseEdge struct {
Data []Catalog `json:"data"`
Paging internal.WhatsAppBusinessApiPaginationMeta `json:"paging"`
}type CatalogManager struct {
requester *request_client.RequestClient
businessAccountId string
}func NewCatalogManager(config *CatalogManagerConfig) *CatalogManagerfunc (cm *CatalogManager) CreateNewProductCatalog() (CreateProductCatalogOptions, error)func (cm *CatalogManager) GetAllCatalogs() (*CatalogFetchResponseEdge, error)func (cm *CatalogManager) GetCatalogProducts(catalogId string) ([]ProductItem, error)GetCatalogProducts retrieves the list of products for a given catalog.
type CatalogManagerConfig struct {
BusinessAccountId string
Requester *request_client.RequestClient
}type Change struct {
Value interface{} `json:"value"`
Field WebhookFieldEnum `json:"field"`
}ChannelEvent represents an event that can be published and subscribed to.
type ChannelEvent struct {
Type events.EventType // Type is the type of the event.
Data events.BaseEvent // Data is the data associated with the event.
}type Contact struct {
WaId string `json:"wa_id"`
Profile Profile `json:"profile"`
}type Conversation struct {
Id string `json:"id"`
Origin Origin `json:"origin,omitempty"`
}type CreatePhoneNumberResponse struct {
Id string `json:"id,omitempty"`
}type CreateProductCatalogOptions struct {
Success string `json:"success,omitempty"`
}DeleteQrCodeResponse represents the response of deleting a QR code.
type DeleteQrCodeResponse struct {
Success bool `json:"success,omitempty"`
}type DeleteSuccessResponse struct {
Success bool `json:"success"`
}type Entry struct {
Id string `json:"id"`
Changes []Change `json:"changes"`
Time *string `json:"time"`
}type Error struct {
Code int `json:"code"`
Title string `json:"title"`
Message string `json:"message"`
Href string `json:"href"`
ErrorData struct {
Details string `json:"details"`
} `json:"error_data"`
}EventManager is responsible for managing events and their subscribers.
type EventManager struct {
subscribers map[events.EventType]chan ChannelEvent // subscribers is a map of event types to channels of ChannelEvent.
sync.RWMutex // RWMutex is used to synchronize access to the subscribers map.
}func NewEventManager() *EventManagerNewEventManager creates a new instance of EventManger.
func (em *EventManager) On(eventName events.EventType, handler func(events.BaseEvent)) events.EventTypeOn registers a handler function for the specified event type. The handler function will be called whenever the event is published. It returns the event type that the handler is registered for.
func (em *EventManager) Publish(event events.EventType, data events.BaseEvent) errorPublish publishes an event to the event system and notifies all the subscribers.
func (em *EventManager) Subscribe(eventName events.EventType) (chan ChannelEvent, error)Subscribe adds a new subscriber to the specified event type. The subscriber will be notified when the event is published.
func (em *EventManager) Unsubscribe(id events.EventType)Unsubscribe removes a subscriber from the specified event type.
GenerateQrCodeResponse represents the response of generating a QR code.
type GenerateQrCodeResponse struct {
Code string `json:"code,omitempty"`
PrefilledMessage string `json:"prefilled_message,omitempty"`
DeepLinkUrl string `json:"deep_link_url,omitempty"`
QrImageUrl string `json:"qr_image_url,omitempty"`
}GetAllQrCodesResponse represents the response of getting all QR codes for a phone number.
type GetAllQrCodesResponse struct {
Data []GenerateQrCodeResponse `json:"data,omitempty"`
}type HandleMessageSubscriptionEventPayload struct {
Messages []Message `json:"messages"`
Statuses []Status `json:"statuses"`
PhoneNumber events.BusinessPhoneNumber `json:"phone_number_id"` // * this is the phone number to which this event has bee sent to
BusinessAccountId string `json:"business_account_id"` // * business account id to which this event has been sent to
SenderName string `json:"sender_name"`
}type ImageCdnUrl struct {
Key string `json:"key"`
Value string `json:"value"`
}type InteractiveNotificationTypeEnum stringconst (
NotificationTypeButtonReply InteractiveNotificationTypeEnum = "button_reply"
NotificationTypeListReply InteractiveNotificationTypeEnum = "list_reply"
)New helper type for key/value pairs.
type KeyValue struct {
Key string `json:"key"`
Value string `json:"value"`
}MediaManager is responsible for managing media related operations.
type MediaManager struct {
requester request_client.RequestClient
}func NewMediaManager(requester request_client.RequestClient) *MediaManagerNewMediaManager creates a new instance of MediaManager.
func (mm *MediaManager) DeleteMedia(id string) (string, error)func (mm *MediaManager) GetMediaUrlById(id string) (string, error)func (mm *MediaManager) UploadMedia(phoneNumberId string, file io.Reader, filename, mimeType string) (string, error)UploadMedia uploads a media file to WhatsApp's Cloud API.
type MediaMetadata struct {
MessagingProduct string `json:"messaging_product"`
Url string `json:"url"`
MimeType string `json:"mime_type"`
Sha256 string `json:"sha256"`
FileSize int `json:"file_size"`
ID string `json:"id"`
}type Message struct {
Id string `json:"id"`
From string `json:"from"`
Timestamp string `json:"timestamp"`
Type NotificationMessageTypeEnum `json:"type"`
Context NotificationPayloadMessageContextSchemaType `json:"context"`
Errors []Error `json:",inline"`
NotificationPayloadTextMessageSchemaType `json:",inline"`
NotificationPayloadAudioMessageSchemaType `json:",inline"`
NotificationPayloadImageMessageSchemaType `json:",inline"`
NotificationPayloadButtonMessageSchemaType `json:",inline"`
NotificationPayloadDocumentMessageSchemaType `json:",inline"`
NotificationPayloadOrderMessageSchemaType `json:",inline"`
NotificationPayloadStickerMessageSchemaType `json:",inline"`
NotificationPayloadSystemMessageSchemaType `json:",inline"`
NotificationPayloadVideoMessageSchemaType `json:",inline"`
NotificationPayloadReactionMessageSchemaType `json:",inline"`
NotificationPayloadLocationMessageSchemaType `json:",inline"`
NotificationPayloadContactMessageSchemaType `json:",inline"`
NotificationPayloadInteractionMessageSchemaType `json:",inline"`
}MessageManager is responsible for managing messages.
type MessageManager struct {
requester request_client.RequestClient
PhoneNumberId string
}func NewMessageManager(requester request_client.RequestClient, phoneNumberId string) *MessageManagerNewMessageManager creates a new instance of MessageManager.
func (mm *MessageManager) Send(message components.BaseMessage, phoneNumber string) (*MessageSendResponse, error)Send sends a message using the provided BaseMessage and returns a structured response. If the API response contains an error, it returns that error.
MessageSendError represents the error object in an API response.
type MessageSendError struct {
Message string `json:"message"` // Error description.
Type string `json:"type"` // Error type (e.g., OAuthException).
Code int `json:"code"` // Error code.
ErrorData struct {
MessagingProduct string `json:"messaging_product"`
Details string `json:"details"`
} `json:"error_data"` // Additional error details.
ErrorSubcode int `json:"error_subcode"`
FbtraceID string `json:"fbtrace_id"`
}MessageSendResponse represents the structured API response for sending a message.
type MessageSendResponse struct {
MessagingProduct string `json:"messaging_product"`
Contacts []struct {
Input string `json:"input"`
WaID string `json:"wa_id"`
} `json:"contacts"`
Messages []struct {
ID string `json:"id"`
} `json:"messages"`
Error *MessageSendError `json:"error,omitempty"`
}type MessageStatusCategoryEnum stringconst (
MessageStatusCategorySent MessageStatusCategoryEnum = "sent"
)type MessageStatusEnum stringconst (
MessageStatusDelivered MessageStatusEnum = "delivered"
MessageStatusRead MessageStatusEnum = "read"
MessageStatusUnDelivered MessageStatusEnum = "undelivered"
MessageStatusFailed MessageStatusEnum = "failed"
MessageStatusSent MessageStatusEnum = "sent"
)MessageTemplateCategory represents the category of a WhatsApp Business message template.
type MessageTemplateCategory stringconst (
MessageTemplateCategoryUtility MessageTemplateCategory = "UTILITY"
MessageTemplateCategoryMarketing MessageTemplateCategory = "MARKETING"
MessageTemplateCategoryAuthentication MessageTemplateCategory = "AUTHENTICATION"
)MessageTemplateComponentFormat represents the format of a template component.
type MessageTemplateComponentFormat stringconst (
MessageTemplateComponentFormatText MessageTemplateComponentFormat = "TEXT"
MessageTemplateComponentFormatImage MessageTemplateComponentFormat = "IMAGE"
MessageTemplateComponentFormatDocument MessageTemplateComponentFormat = "DOCUMENT"
MessageTemplateComponentFormatVideo MessageTemplateComponentFormat = "VIDEO"
MessageTemplateComponentFormatLocation MessageTemplateComponentFormat = "LOCATION"
)MessageTemplateComponentType represents the type of a template component.
type MessageTemplateComponentType stringconst (
MessageTemplateComponentTypeGreeting MessageTemplateComponentType = "GREETING"
MessageTemplateComponentTypeHeader MessageTemplateComponentType = "HEADER"
MessageTemplateComponentTypeBody MessageTemplateComponentType = "BODY"
MessageTemplateComponentTypeFooter MessageTemplateComponentType = "FOOTER"
MessageTemplateComponentTypeButtons MessageTemplateComponentType = "BUTTONS"
MessageTemplateComponentTypeCarousel MessageTemplateComponentType = "CAROUSEL" // this appears in case of product caraousel
MessageTemplateComponentTypeLimitedTimeOffer MessageTemplateComponentType = "LIMITED_TIME_OFFER"
)MessageTemplateCreationResponse represents the response after creating a template.
type MessageTemplateCreationResponse struct {
Id string `json:"id,omitempty"`
Status MessageTemplateStatus `json:"status,omitempty"`
Category MessageTemplateCategory `json:"category,omitempty"`
}MessageTemplateStatus represents the status of a WhatsApp Business message template.
type MessageTemplateStatus stringconst (
MessageTemplateStatusApproved MessageTemplateStatus = "APPROVED"
MessageTemplateStatusRejected MessageTemplateStatus = "REJECTED"
MessageTemplateStatusPending MessageTemplateStatus = "PENDING"
)type MessagesValue struct {
MessagingProduct string `json:"messaging_product"`
Metadata Metadata `json:"metadata"`
Contacts []Contact `json:"contacts,omitempty"`
Statuses []Status `json:"statuses,omitempty"`
Messages []Message `json:"messages,omitempty"`
Errors []Error `json:"errors,omitempty"`
}type Metadata struct {
DisplayPhoneNumber string `json:"display_phone_number"`
PhoneNumberId string `json:"phone_number_id"`
}NamedParamExample represents a single named parameter and its example value.
type NamedParamExample struct {
ParamName string `json:"param_name"`
Example string `json:"example"`
}type NotificationMessageTypeEnum stringconst (
NotificationMessageTypeText NotificationMessageTypeEnum = "text"
NotificationMessageTypeAudio NotificationMessageTypeEnum = "audio"
NotificationMessageTypeImage NotificationMessageTypeEnum = "image"
NotificationMessageTypeButton NotificationMessageTypeEnum = "button"
NotificationMessageTypeDocument NotificationMessageTypeEnum = "document"
NotificationMessageTypeOrder NotificationMessageTypeEnum = "order"
NotificationMessageTypeSticker NotificationMessageTypeEnum = "sticker"
NotificationMessageTypeSystem NotificationMessageTypeEnum = "system"
NotificationMessageTypeVideo NotificationMessageTypeEnum = "video"
NotificationMessageTypeReaction NotificationMessageTypeEnum = "reaction"
NotificationMessageTypeInteractive NotificationMessageTypeEnum = "interactive"
NotificationMessageTypeUnknown NotificationMessageTypeEnum = "unknown"
NotificationMessageTypeLocation NotificationMessageTypeEnum = "location"
NotificationMessageTypeContacts NotificationMessageTypeEnum = "contacts"
)type NotificationPayloadAudioMessageSchemaType struct {
Audio struct {
Id string `json:"id,omitempty"`
MIMEType string `json:"mime_type,omitempty"`
SHA256 string `json:"sha256,omitempty"`
} `json:"audio,omitempty"`
}type NotificationPayloadButtonInteractionMessageSchemaType struct {
ButtonReply struct {
ReplyId string `json:"reply_id"`
Title string `json:"title"`
} `json:"button_reply,omitempty"`
}type NotificationPayloadButtonMessageSchemaType struct {
Button struct {
Payload string `json:"payload"`
Text string `json:"text"`
} `json:"button,omitempty"`
}type NotificationPayloadContactMessageSchemaType struct {
Contacts []Contact `json:"contacts"`
}type NotificationPayloadDocumentMessageSchemaType struct {
Document struct {
Id string `json:"id"`
MIMEType string `json:"mime_type"`
SHA256 string `json:"sha256"`
Caption string `json:"caption,omitempty"`
Filename string `json:"filename,omitempty"`
} `json:"document,omitempty"`
}type NotificationPayloadErrorSchemaType struct {
Code int `json:"code"`
Title string `json:"title"`
Message string `json:"message"`
ErrorData struct {
Details string `json:"details"`
} `json:"error_data,omitempty"`
}type NotificationPayloadImageMessageSchemaType struct {
Image struct {
Id string `json:"id"`
MIMEType string `json:"mime_type"`
SHA256 string `json:"sha256"`
Caption string `json:"caption,omitempty"`
} `json:"image,omitempty"`
}type NotificationPayloadInteractionMessageSchemaType struct {
Interactive struct {
Type InteractiveNotificationTypeEnum `json:"type"`
NotificationPayloadButtonInteractionMessageSchemaType `json:",inline,omitempty"`
NotificationPayloadListInteractionMessageSchemaType `json:",inline,omitempty"`
} `json:"interactive,omitempty"`
}type NotificationPayloadListInteractionMessageSchemaType struct {
ListReply struct {
Id string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
} `json:"list_reply,omitempty"`
}type NotificationPayloadLocationMessageSchemaType struct {
Location struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Name string `json:"name,omitempty"`
Address string `json:"address,omitempty"`
} `json:"location,omitempty"`
}type NotificationPayloadMessageContextSchemaType struct {
Forwarded bool `json:"forwarded,omitempty"`
FrequentlyForwarded bool `json:"frequently_forwarded,omitempty"`
From string `json:"from,omitempty"`
Id string `json:"id"`
ReferredProduct struct {
CatalogId string `json:"catalog_id"`
ProductRetailerId string `json:"product_retailer_id"`
} `json:"referred_product,omitempty"`
}type NotificationPayloadOrderMessageSchemaType struct {
// OrderText string `json:"text"`
Order struct {
CatalogId string `json:"catalog_id"`
ProductItems []struct {
ProductRetailerId string `json:"product_retailer_id"`
Quantity string `json:"quantity"`
ItemPrice string `json:"item_price"`
Currency string `json:"currency"`
} `json:"product_items"`
} `json:"order,omitempty"`
}type NotificationPayloadReactionMessageSchemaType struct {
Reaction struct {
MessageId string `json:"message_id"`
Emoji string `json:"emoji"`
} `json:"reaction,omitempty"`
}type NotificationPayloadStickerMessageSchemaType struct {
Sticker struct {
Id string `json:"id"`
MIMEType string `json:"mime_type"`
SHA256 string `json:"sha256"`
Animated bool `json:"animated"`
} `json:"sticker,omitempty"`
}type NotificationPayloadSystemMessageSchemaType struct {
System struct {
Identity string `json:"identity"`
Body string `json:"body"`
Customer string `json:"customer"`
Type SystemNotificationTypeEnum `json:"type"`
WaId string `json:"wa_id"`
} `json:"system,omitempty"`
Identity struct {
Acknowledged string `json:"acknowledged"`
CreatedTimestamp string `json:"created_timestamp"`
Hash string `json:"hash"`
} `json:"identity,omitempty"`
}type NotificationPayloadTextMessageSchemaType struct {
Text struct {
Body string `json:"body"`
} `json:"text,omitempty"`
Referral struct {
SourceUrl string `json:"source_url"`
SourceType AdInteractionSourceTypeEnum `json:"source_type"`
SourceId string `json:"source_id"`
Headline string `json:"headline"`
Body string `json:"body"`
ImageUrl string `json:"image_url,omitempty"`
VideoUrl string `json:"video_url,omitempty"`
ThumbnailUrl string `json:"thumbnail_url"`
CtwaCLId string `json:"ctwa_clid"`
MediaType AdInteractionSourceMediaTypeEnum `json:"media_type"`
} `json:"referral,omitempty"`
}type NotificationPayloadVideoMessageSchemaType struct {
Video struct {
Id string `json:"id"`
MIMEType string `json:"mime_type"`
SHA256 string `json:"sha256"`
Caption string `json:"caption,omitempty"`
Filename string `json:"filename,omitempty"`
} `json:"video,omitempty"`
}type NotificationReasonEnum stringconst (
NotificationReasonMessage NotificationReasonEnum = "message"
)type Origin struct {
Type MessageStatusCategoryEnum `json:"type"`
ExpirationTimestamp string `json:"expiration_timestamp,omitempty"`
}PhoneNumberManager is responsible for managing phone numbers for WhatsApp Business API and phone number specific operations.
type PhoneNumberManager struct {
businessAccountId string
apiAccessToken string
requester *request_client.RequestClient
}func NewPhoneNumberManager(config *PhoneNumberManagerConfig) *PhoneNumberManagerNewPhoneNumberManager creates a new instance of PhoneNumberManager.
func (manager *PhoneNumberManager) Create(phoneNumber, verifiedName, countryCode string) (CreatePhoneNumberResponse, error)func (manager *PhoneNumberManager) DeleteQrCode(phoneNumber, id string) (*DeleteQrCodeResponse, error)DeleteQrCode deletes a QR code by its ID for the specified phone number.
func (manager *PhoneNumberManager) Fetch(phoneNumberId string) (*WhatsappBusinessAccountPhoneNumber, error)Fetch fetches a phone number by its ID.
func (manager *PhoneNumberManager) FetchAll(getSandBoxNumbers bool) (*WhatsappBusinessAccountPhoneNumberEdge, error)FetchAll fetches all phone numbers based on the provided filters.
func (manager *PhoneNumberManager) GenerateQrCode(phoneNumber string, prefilledMessage string) (*GenerateQrCodeResponse, error)GenerateQrCode generates a QR code for the specified phone number with the given prefilled message.
func (manager *PhoneNumberManager) GetAllQrCodes(phoneNumber string) (*GetAllQrCodesResponse, error)GetAllQrCodes gets all QR codes for the specified phone number.
func (manager *PhoneNumberManager) GetQrCodeById(phoneNumber, id string) (*GetAllQrCodesResponse, error)GetQrCodeById gets a QR code by its ID for the specified phone number.
func (manager *PhoneNumberManager) RequestVerificationCode(phoneNumberId string, codeMethod VerifyCodeMethod, languageCode string) (RequestVerificationCodeResponse, error)func (manager *PhoneNumberManager) UpdateQrCode(phoneNumber, id, prefilledMessage string) (*GenerateQrCodeResponse, error)UpdateQrCode updates a QR code by its ID for the specified phone number with the given prefilled message.
func (manager *PhoneNumberManager) VerifyCode(phoneNumberId, verificationCode string) (VerifyCodeResponse, error)PhoneNumberManagerConfig holds the configuration for PhoneNumberManager.
type PhoneNumberManagerConfig struct {
BusinessAccountId string
ApiAccessToken string
Requester *request_client.RequestClient
}type PhoneNumberNameUpdateValue struct {
DisplayPhoneNumber string `json:"display_phone_number"`
Decision string `json:"decision"`
RequestedVerifiedName string `json:"requested_verified_name"`
RejectionReason string `json:"rejection_reason"`
}type PhoneNumberQualityUpdateCurrentLimitEnum stringconst (
PhoneNumberQualityUpdateCurrentLimitEnumTier50 PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_50"
PhoneNumberQualityUpdateCurrentLimitEnumTier250 PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_250"
PhoneNumberQualityUpdateCurrentLimitEnumTier1K PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_1K"
PhoneNumberQualityUpdateCurrentLimitEnumTier10K PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_10K"
PhoneNumberQualityUpdateCurrentLimitEnumTier100K PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_100K"
PhoneNumberQualityUpdateCurrentLimitEnumTierUnlimited PhoneNumberQualityUpdateCurrentLimitEnum = "TIER_UNLIMITED"
)type PhoneNumberQualityUpdateValue struct {
DisplayPhoneNumber string `json:"display_phone_number"`
Event string `json:"event"`
CurrentLimit PhoneNumberQualityUpdateCurrentLimitEnum `json:"current_limit"`
}type Pricing struct {
PricingModel string `json:"pricing_model"`
Category MessageStatusCategoryEnum `json:"category"`
}type ProductGroup struct {
ID string `json:"id"`
RetailerID string `json:"retailer_id"`
}type ProductItem struct {
Id string `json:"id"`
AdditionalImageCdnUrls []ImageCdnUrl `json:"additional_image_cdn_urls,omitempty"`
AdditionalImageUrls []string `json:"additional_image_urls,omitempty"`
AdditionalVariantAttributes []KeyValue `json:"additional_variant_attributes,omitempty"`
AgeGroup string `json:"age_group,omitempty"`
Applinks *Applinks `json:"applinks,omitempty"`
Availability string `json:"availability,omitempty"`
Brand string `json:"brand,omitempty"`
CapabilityToReviewStatus []KeyValue `json:"capability_to_review_status,omitempty"`
Category string `json:"category,omitempty"`
CategorySpecificFields interface{} `json:"category_specific_fields,omitempty"`
Color string `json:"color,omitempty"`
CommerceInsights string `json:"commerce_insights,omitempty"`
Condition string `json:"condition,omitempty"`
Currency string `json:"currency,omitempty"`
CustomData []KeyValue `json:"custom_data,omitempty"`
CustomLabel0 string `json:"custom_label_0,omitempty"`
CustomLabel1 string `json:"custom_label_1,omitempty"`
CustomLabel2 string `json:"custom_label_2,omitempty"`
CustomLabel3 string `json:"custom_label_3,omitempty"`
CustomLabel4 string `json:"custom_label_4,omitempty"`
CustomNumber0 string `json:"custom_number_0,omitempty"`
CustomNumber1 string `json:"custom_number_1,omitempty"`
CustomNumber2 string `json:"custom_number_2,omitempty"`
CustomNumber3 string `json:"custom_number_3,omitempty"`
CustomNumber4 string `json:"custom_number_4,omitempty"`
Description string `json:"description,omitempty"`
Errors []string `json:"errors,omitempty"`
ExpirationDate string `json:"expiration_date,omitempty"`
FbProductCategory string `json:"fb_product_category,omitempty"`
Gender string `json:"gender,omitempty"`
Gtin string `json:"gtin,omitempty"`
ImageCdnUrls []ImageCdnUrl `json:"image_cdn_urls,omitempty"`
ImageFetchStatus string `json:"image_fetch_status,omitempty"`
ImageUrl string `json:"image_url,omitempty"`
Images []string `json:"images,omitempty"`
ImporterAddress string `json:"importer_address,omitempty"`
ImporterName string `json:"importer_name,omitempty"`
InvalidationErrors []string `json:"invalidation_errors,omitempty"`
Inventory int `json:"inventory,omitempty"`
ManufacturerInfo string `json:"manufacturer_info,omitempty"`
ManufacturerPartNumber string `json:"manufacturer_part_number,omitempty"`
MarkedForProductLaunch string `json:"marked_for_product_launch,omitempty"`
Material string `json:"material,omitempty"`
MobileLink string `json:"mobile_link,omitempty"`
Name string `json:"name,omitempty"`
OrderingIndex int `json:"ordering_index,omitempty"`
OriginCountry string `json:"origin_country,omitempty"`
ParentProductID string `json:"parent_product_id,omitempty"`
Pattern string `json:"pattern,omitempty"`
PostConversionSignalBasedEnforcementAppealEligibility bool `json:"post_conversion_signal_based_enforcement_appeal_eligibility,omitempty"`
Price string `json:"price,omitempty"`
ProductFeed string `json:"product_feed,omitempty"`
ProductGroup *ProductGroup `json:"product_group,omitempty"`
ProductLocalInfo string `json:"product_local_info,omitempty"`
ProductType string `json:"product_type,omitempty"`
QuantityToSellOnFacebook int `json:"quantity_to_sell_on_facebook,omitempty"`
RetailerId string `json:"retailer_id,omitempty"`
RetailerProductGroupID string `json:"retailer_product_group_id,omitempty"`
ReviewRejectionReasons []string `json:"review_rejection_reasons,omitempty"`
ReviewStatus string `json:"review_status,omitempty"`
SalePrice string `json:"sale_price,omitempty"`
SalePriceEndDate string `json:"sale_price_end_date,omitempty"`
SalePriceStartDate string `json:"sale_price_start_date,omitempty"`
ShippingWeightUnit string `json:"shipping_weight_unit,omitempty"`
ShippingWeightValue float64 `json:"shipping_weight_value,omitempty"`
ShortDescription string `json:"short_description,omitempty"`
Size string `json:"size,omitempty"`
StartDate string `json:"start_date,omitempty"`
Tags []string `json:"tags,omitempty"`
Url string `json:"url,omitempty"`
VendorId string `json:"vendor_id,omitempty"`
VideoFetchStatus string `json:"video_fetch_status,omitempty"`
Visibility string `json:"visibility,omitempty"`
WaComplianceCategory string `json:"wa_compliance_category,omitempty"`
}ProductSet represents a product set within a catalog.
type ProductSet struct {
Id string `json:"id"`
AutoCreationUrl string `json:"auto_creation_url,omitempty"`
Filter string `json:"filter,omitempty"`
LatestMetadata ProductSetMetadata `json:"latest_metadata,omitempty"`
LiveMetadata ProductSetMetadata `json:"live_metadata,omitempty"`
Name string `json:"name"`
// Omit full ProductCatalog to avoid cyclic properties; use catalog Id instead.
ProductCount uint32 `json:"product_count"`
RetailerId string `json:"retailer_id,omitempty"`
}ProductSetMetadata represents metadata for a product set.
type ProductSetMetadata struct {
// Define minimal metadata fields as needed.
// For example:
UpdateTime string `json:"update_time,omitempty"`
}type Profile struct {
Name string `json:"name"`
}type RequestVerificationCodeResponse struct {
Success bool `json:"success,omitempty"`
}type SecurityValue struct {
DisplayPhoneNumber string `json:"display_phone_number"`
Event string `json:"event"`
Requester string `json:"requester"`
}type Status struct {
Id string `json:"id"`
Conversation Conversation `json:"conversation,omitempty"`
Errors []Error `json:"errors,omitempty"`
Status string `json:"status"`
Timestamp string `json:"timestamp"`
RecipientId string `json:"recipient_id"`
Pricing Pricing `json:"pricing,omitempty"`
}type SystemNotificationTypeEnum stringconst (
SystemNotificationTypeCustomerPhoneNumberChange SystemNotificationTypeEnum = "user_changed_number"
SystemNotificationTypeCustomerIdentityChanged SystemNotificationTypeEnum = "customer_identity_changed"
)type TemplateCategoryUpdateValue struct {
MessageTemplateId int64 `json:"message_template_id"`
MessageTemplateName string `json:"message_template_name"`
MessageTemplateLanguage string `json:"message_template_language"`
PreviousCategory MessageTemplateCategory `json:"previous_category"`
NewCategory MessageTemplateCategory `json:"new_category"`
CorrectCategory MessageTemplateCategory `json:"correct_category"`
}TemplateManager is responsible for managing WhatsApp Business message templates.
type TemplateManager struct {
businessAccountId string
apiAccessToken string
requester *request_client.RequestClient
}func NewTemplateManager(config *TemplateManagerConfig) *TemplateManagerNewTemplateManager creates a new TemplateManager with the given configuration.
func (manager *TemplateManager) Create(body WhatsappMessageTemplateCreateRequestBody) (*MessageTemplateCreationResponse, error)Create sends a creation request for a message template.
func (tm *TemplateManager) Delete(id string)Delete dissociates a template (delete implementation to be added as needed).
func (manager *TemplateManager) Fetch(Id string) (*WhatsAppBusinessMessageTemplateNode, error)Fetch fetches a single WhatsApp Business message template by its ID.
func (manager *TemplateManager) FetchAll() (*WhatsAppBusinessTemplatesFetchResponseEdge, error)FetchAll fetches all WhatsApp Business message templates.
func (manager *TemplateManager) MigrateFromOtherBusinessAccount(sourcePageNumber int, sourceWabaId int) (*TemplateMigrationResponse, error)MigrateFromOtherBusinessAccount migrates templates from another business account.
func (manager *TemplateManager) Update(templateId string, updates WhatsAppBusinessAccountMessageTemplateUpdateRequestBody) (*MessageTemplateCreationResponse, error)Update sends an update request for a template.
TemplateManagerConfig represents the configuration for creating a new TemplateManager.
type TemplateManagerConfig struct {
BusinessAccountId string
ApiAccessToken string
Requester *request_client.RequestClient
}TemplateMessageButtonType represents the type of a button.
type TemplateMessageButtonType stringconst (
TemplateMessageButtonTypeQuickReply TemplateMessageButtonType = "QUICK_REPLY"
TemplateMessageButtonTypeUrl TemplateMessageButtonType = "URL"
TemplateMessageButtonTypePhoneNumber TemplateMessageButtonType = "PHONE_NUMBER"
TemplateMessageButtonTypeCopyCode TemplateMessageButtonType = "COPY_CODE"
TemplateMessageButtonTypeCatalog TemplateMessageButtonType = "CATALOG"
TemplateMessageButtonTypeMultiProductMessage TemplateMessageButtonType = "MPM"
)TemplateMessageComponentButton represents a button component in a message template.
type TemplateMessageComponentButton struct {
Type TemplateMessageButtonType `json:"type,omitempty"`
Text string `json:"text,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"` // required when Type = PHONE_NUMBER
Example []string `json:"example,omitempty"` // required when Type = URL and button uses a variable
Url string `json:"url,omitempty"` // required when Type = URL
}TemplateMessageComponentCard represents a card component in a message template.
type TemplateMessageComponentCard struct {
// Add card-specific fields if needed.
Components []WhatsAppBusinessHSMWhatsAppHSMComponent `json:"components,omitempty"`
}TemplateMessageComponentExample represents an example object for a template component.
type TemplateMessageComponentExample struct {
HeaderHandle *[]string `json:"header_handle,omitempty"` // for media headers (IMAGE, VIDEO, DOCUMENT)
HeaderTextNamedParams *[]NamedParamExample `json:"header_text_named_params,omitempty"` // for named header params
HeaderText *[]string `json:"header_text,omitempty"` // for text headers (positional examples)
BodyText *[][]string `json:"body_text,omitempty"` // for body components (array of arrays for positional examples)
BodyTextNamedParams *[]NamedParamExample `json:"body_text_named_params,omitempty"`
}TemplateMessageLimitedTimeOfferParameter represents a limited time offer parameter.
type TemplateMessageLimitedTimeOfferParameter struct {
Text string `json:"text,omitempty"`
HasExpiration bool `json:"has_expiration,omitempty"`
}TemplateMessagePreviewEdge represents the preview response.
type TemplateMessagePreviewEdge struct {
Data []TemplateMessagePreviewNode `json:"data,omitempty"`
Paging internal.WhatsAppBusinessApiPaginationMeta `json:"paging,omitempty"`
}TemplateMessagePreviewNode represents a preview node.
type TemplateMessagePreviewNode struct {
Body string `json:"body,omitempty"`
Buttons []WhatsAppBusinessAccountMessageTemplatePreviewButton `json:"buttons,omitempty"`
Footer string `json:"footer,omitempty"`
Header string `json:"header,omitempty"`
Language string `json:"language,omitempty"`
}TemplateMessageQualityScore represents the quality score of a template.
type TemplateMessageQualityScore struct {
Date int `json:"date,omitempty"`
Reasons []string `json:"reasons,omitempty"`
Score int `json:"score,omitempty"`
}type TemplateMessageRejectionReasonEnum stringconst (
TemplateMessageRejectionReasonEnumAbusiveContent TemplateMessageRejectionReasonEnum = "ABUSIVE_CONTENT"
TemplateMessageRejectionReasonEnumIncorrectCategory TemplateMessageRejectionReasonEnum = "INCORRECT_CATEGORY"
TemplateMessageRejectionReasonEnumInvalidFormat TemplateMessageRejectionReasonEnum = "INVALID_FORMAT"
TemplateMessageRejectionReasonEnumNone TemplateMessageRejectionReasonEnum = "NONE"
TemplateMessageRejectionReasonEnumScam TemplateMessageRejectionReasonEnum = "SCAM"
)type TemplateMessageStatusUpdateDisableInfo struct {
DisableDate string `json:"disable_date"`
}type TemplateMessageStatusUpdateEventEnum stringconst (
TemplateMessageStatusUpdateEventEnumApproved TemplateMessageStatusUpdateEventEnum = "APPROVED"
TemplateMessageStatusUpdateEventEnumRejected TemplateMessageStatusUpdateEventEnum = "REJECTED"
TemplateMessageStatusUpdateEventEnumFlaggedForDisabling TemplateMessageStatusUpdateEventEnum = "FLAGGED"
TemplateMessageStatusUpdateEventEnumPaused TemplateMessageStatusUpdateEventEnum = "PAUSED"
TemplateMessageStatusUpdateEventEnumPendingDeletion TemplateMessageStatusUpdateEventEnum = "PENDING_DELETION"
)type TemplateMessageStatusUpdateOtherInfo struct {
Title string `json:"title"`
}TemplateMigrationResponse represents the migration response.
type TemplateMigrationResponse struct {
MigratedTemplates []string `json:"migrated_templates,omitempty"`
FailedTemplates map[string]string `json:"failed_templates,omitempty"`
}type TemplateQualityUpdateValue struct {
PreviousQualityScore string `json:"previous_quality_score"`
NewQualityScore string `json:"new_quality_score"`
MessageTemplateId int64 `json:"message_template_id"`
MessageTemplateName string `json:"message_template_name"`
MessageTemplateLanguage string `json:"message_template_language"`
}type TemplateStatusUpdateValue struct {
Event TemplateMessageStatusUpdateEventEnum `json:"event"`
MessageTemplateId int64 `json:"message_template_id"`
MessageTemplateName string `json:"message_template_name"`
MessageTemplateLanguage string `json:"message_template_language"`
Reason TemplateMessageRejectionReasonEnum `json:"reason"`
DisableInfo TemplateMessageStatusUpdateDisableInfo `json:"disable_info,omitempty"`
OtherInfo TemplateMessageStatusUpdateOtherInfo `json:"other_info,omitempty"`
}type VerifyCodeMethod stringconst (
VerifyCodeMethodSms VerifyCodeMethod = "SMS"
VerifyCodeMethodVoice VerifyCodeMethod = "VOICE"
)type VerifyCodeResponse struct {
Success bool `json:"success,omitempty"`
}type WebApplink struct {
ShouldFallback bool `json:"should_fallback"`
URL string `json:"url"`
}type WebhookFieldEnum stringconst (
WebhookFieldEnumAccountAlerts WebhookFieldEnum = "account_alerts"
WebhookFieldEnumMessages WebhookFieldEnum = "messages"
WebhookFieldEnumSecurity WebhookFieldEnum = "security"
WebhookFieldEnumAccountUpdate WebhookFieldEnum = "account_update"
WebhookFieldEnumAccountReview WebhookFieldEnum = "account_review"
WebhookFieldEnumBusinessCapability WebhookFieldEnum = "business_capability"
WebhookFieldEnumMessageTemplateQuality WebhookFieldEnum = "message_template_quality"
WebhookFieldEnumMessageTemplateStatus WebhookFieldEnum = "message_template_status"
WebhookFieldEnumPhoneNumberName WebhookFieldEnum = "phone_number_name"
WebhookFieldEnumPhoneNumberQuality WebhookFieldEnum = "phone_number_quality"
WebhookFieldEnumTemplateCategoryUpdate WebhookFieldEnum = "template_category"
)WebhookManager represents a manager for handling webhooks.
type WebhookManager struct {
secret string
path string
port int
EventManager EventManager
Requester request_client.RequestClient
}func NewWebhook(options *WebhookManagerConfig) *WebhookManagerNewWebhook creates a new WebhookManager with the given options.
func (wh *WebhookManager) GetRequestHandler(c echo.Context) errorGetRequestHandler handles GET requests to the webhook endpoint.
func (wh *WebhookManager) ListenToEvents()ListenToEvents starts listening to events and handles incoming requests.
func (wh *WebhookManager) PostRequestHandler(c echo.Context) errorPostRequestHandler handles POST requests to the webhook endpoint.
func (wh *WebhookManager) createEchoHttpServer() *echo.EchocreateEchoHttpServer creates a new instance of Echo HTTP server. This function is used in case the client has not provided any custom HTTP server.
func (wh *WebhookManager) handleAccountAlertsSubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value AccountAlertsValue) errorfunc (wh *WebhookManager) handleAccountReviewSubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value AccountReviewUpdateValue) errorfunc (wh *WebhookManager) handleAccountUpdateSubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value AccountUpdateValue)func (wh *WebhookManager) handleBusinessCapabilitySubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value BusinessCapabilityUpdateValue) errorfunc (wh *WebhookManager) handleMessageTemplateQualitySubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value TemplateQualityUpdateValue) errorfunc (wh *WebhookManager) handleMessageTemplateStatusSubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value TemplateStatusUpdateValue) errorfunc (wh *WebhookManager) handleMessagesSubscriptionEvents(payload HandleMessageSubscriptionEventPayload) errorfunc (wh *WebhookManager) handlePhoneNumberNameSubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value PhoneNumberNameUpdateValue) errorfunc (wh *WebhookManager) handlePhoneNumberQualitySubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value PhoneNumberQualityUpdateValue) errorfunc (wh *WebhookManager) handleSecuritySubscriptionEvents(value SecurityValue)func (wh *WebhookManager) handleTemplateCategoryUpdateSubscriptionEvents(baseEvent events.BaseBusinessAccountEvent, value TemplateCategoryUpdateValue) errorWebhookManagerConfig represents the configuration options for creating a new WebhookManager.
type WebhookManagerConfig struct {
Secret string `validate:"required"`
EventManager EventManager `validate:"required"`
Requester request_client.RequestClient `validate:"required"`
Path string
Port int
}WhatsAppBusinessAccountMessageTemplateDeleteRequestBody represents the request body for deleting a template.
type WhatsAppBusinessAccountMessageTemplateDeleteRequestBody struct {
HsmId string `json:"hsm_id,omitempty"`
Name string `json:"name,omitempty"`
}WhatsAppBusinessAccountMessageTemplatePreviewButton represents a preview button.
type WhatsAppBusinessAccountMessageTemplatePreviewButton struct {
AutoFillText string `json:"auto_fill_text,omitempty"`
Text string `json:"text,omitempty"`
}WhatsAppBusinessAccountMessageTemplateUpdateRequestBody represents the request body for updating a template.
type WhatsAppBusinessAccountMessageTemplateUpdateRequestBody struct {
Components []WhatsappMessageTemplateComponentCreateOrUpdateRequestBody `json:"components,omitempty"`
Category string `json:"category,omitempty"`
MessageSendTtlSeconds int `json:"message_send_ttl_seconds,omitempty"`
}WhatsAppBusinessHSMWhatsAppHSMComponent represents a component in a message template. Note: The "Type" field here now uses MessageTemplateComponentType.
type WhatsAppBusinessHSMWhatsAppHSMComponent struct {
AddSecurityRecommendation bool `json:"add_security_recommendation,omitempty"`
Buttons []TemplateMessageComponentButton `json:"buttons,omitempty"`
Cards []TemplateMessageComponentCard `json:"cards,omitempty"`
CodeExpirationMinutes int `json:"code_expiration_minutes,omitempty"`
Example *TemplateMessageComponentExample `json:"example,omitempty"`
Format MessageTemplateComponentFormat `json:"format,omitempty"`
LimitedTimeOffer *TemplateMessageLimitedTimeOfferParameter `json:"limited_time_offer,omitempty"`
Text string `json:"text,omitempty"`
Type MessageTemplateComponentType `json:"type,omitempty"`
}WhatsAppBusinessMessageTemplateNode represents a WhatsApp Business message template.
type WhatsAppBusinessMessageTemplateNode struct {
Id string `json:"id,omitempty"`
Category MessageTemplateCategory `json:"category,omitempty"`
Components []WhatsAppBusinessHSMWhatsAppHSMComponent `json:"components,omitempty"`
CorrectCategory string `json:"correct_category,omitempty"`
CtaUrlLinkTrackingOptedOut bool `json:"cta_url_link_tracking_opted_out,omitempty"`
Language string `json:"language,omitempty"`
LibraryTemplateName string `json:"library_template_name,omitempty"`
MessageSendTtlSeconds int `json:"message_send_ttl_seconds,omitempty"`
Name string `json:"name,omitempty"`
PreviousCategory string `json:"previous_category,omitempty"`
QualityScore TemplateMessageQualityScore `json:"quality_score,omitempty"`
RejectedReason string `json:"rejected_reason,omitempty"`
Status MessageTemplateStatus `json:"status,omitempty"`
}WhatsAppBusinessTemplatesFetchResponseEdge represents the response structure for fetching templates.
type WhatsAppBusinessTemplatesFetchResponseEdge struct {
Data []WhatsAppBusinessMessageTemplateNode `json:"data,omitempty"`
Paging internal.WhatsAppBusinessApiPaginationMeta `json:"paging,omitempty"`
}type WhatsappApiNotificationPayloadSchemaType struct {
Object string `json:"object"`
Entry []Entry `json:"entry"`
}WhatsappBusinessAccountPhoneNumber represents a WhatsApp Business Account phone number.
type WhatsappBusinessAccountPhoneNumber struct {
VerifiedName string `json:"verified_name,omitempty"`
DisplayPhoneNumber string `json:"display_phone_number,omitempty"`
Id string `json:"id,omitempty"`
QualityRating string `json:"quality_rating,omitempty"`
CodeVerificationStatus string `json:"code_verification_status,omitempty"`
Status string `json:"status,omitempty"` // CONNECTED
PlatformType string `json:"platform_type,omitempty"`
CountryDialCode string `json:"country_dial_code,omitempty"`
SearchVisibility string `json:"search_visibility,omitempty"`
}WhatsappBusinessAccountPhoneNumberEdge represents a list of WhatsApp Business Account phone numbers.
type WhatsappBusinessAccountPhoneNumberEdge struct {
Data []WhatsappBusinessAccountPhoneNumber `json:"data,omitempty"`
Paging internal.WhatsAppBusinessApiPaginationMeta `json:"paging,omitempty"`
Summary string `json:"summary,omitempty"`
}WhatsappMessageTemplateButtonCreateRequestBody represents the request body for creating a button.
type WhatsappMessageTemplateButtonCreateRequestBody struct {
Type string `json:"type,omitempty"`
Text string `json:"text,omitempty"`
Url string `json:"url,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
Example []string `json:"example,omitempty"` // For URL buttons with variables.
FlowId string `json:"flow_id,omitempty"`
ZeroTapTermsAccepted bool `json:"zero_tap_terms_accepted,omitempty"`
}WhatsappMessageTemplateButtonCreateRequestBody alias used in component creation.
type WhatsappMessageTemplateButtonCreateRequestBodyAlias = WhatsappMessageTemplateButtonCreateRequestBodyWhatsappMessageTemplateComponentCreateOrUpdateRequestBody represents the request body for creating/updating a component.
type WhatsappMessageTemplateComponentCreateOrUpdateRequestBody struct {
Type MessageTemplateComponentType `json:"type,omitempty"`
Format MessageTemplateComponentFormat `json:"format,omitempty"`
Text string `json:"text,omitempty"`
Buttons []WhatsappMessageTemplateButtonCreateRequestBody `json:"buttons,omitempty"`
Example *TemplateMessageComponentExample `json:"example,omitempty"`
}WhatsappMessageTemplateCreateRequestBody represents the request body for creating a message template.
type WhatsappMessageTemplateCreateRequestBody struct {
AllowCategoryChange bool `json:"allow_category_change,omitempty"`
Category string `json:"category,omitempty" validate:"required"`
Components []WhatsappMessageTemplateComponentCreateOrUpdateRequestBody `json:"components" validate:"required"`
Name string `json:"name,omitempty" validate:"required"`
Language string `json:"language" validate:"required"`
LibraryTemplateName string `json:"library_template_name,omitempty"`
LibraryTemplateButtonInputs []WhatsappMessageTemplateButtonCreateRequestBody `json:"library_template_button_inputs,omitempty"`
}func (body *WhatsappMessageTemplateCreateRequestBody) AddComponent(component WhatsappMessageTemplateComponentCreateOrUpdateRequestBody)AddComponent appends a component to the template creation request body.