Packages Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import "github.com/wapikit/wapi.go/pkg/components"
type AddressType string
const (
HomeAddress AddressType = "HOME"
WorkAddress AddressType = "WORK"
)
const (
HomeUrl AddressType = "HOME"
WorkUrl AddressType = "WORK"
)
type ApiCompatibleJsonConverterConfigs struct {
ReplyToMessageId string
SendToPhoneNumber string
}
type AudioMessage struct {
Id string `json:"id,omitempty"`
Link string `json:"link,omitempty"`
}
func NewAudioMessage(params AudioMessageConfigs) (*AudioMessage, error)
func (audio *AudioMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type AudioMessageApiPayload struct {
BaseMessagePayload
Audio AudioMessage `json:"audio" validate:"required"`
}
type AudioMessageConfigs = AudioMessage
type BaseMessage interface {
ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
}
type BaseMessagePayload struct {
Context *Context `json:"context,omitempty"`
To string `json:"to"`
Type MessageType `json:"type"`
MessagingProduct string `json:"messaging_product"`
RecipientType string `json:"recipient_type"`
}
func NewBaseMessagePayload(to string, messageType MessageType) BaseMessagePayload
type CatalogMessage struct {
Type InteractiveMessageType `json:"type" validate:"required"`
Action CatalogMessageAction `json:"action" validate:"required"`
Body CatalogMessageBody `json:"body" validate:"required"`
Footer *CatalogMessageFooter `json:"footer,omitempty"`
Header *CatalogMessageHeader `json:"header,omitempty"`
}
func NewCatalogMessage(name, thumbnailProductRetailerId string) (*CatalogMessage, error)
func (m *CatalogMessage) SetBody(text string)
func (m *CatalogMessage) SetFooter(text string)
func (m *CatalogMessage) SetHeader(text string)
func (m *CatalogMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type CatalogMessageAction struct {
Name string `json:"name" validate:"required"`
Parameters CatalogMessageActionParameter `json:"parameters,omitempty"`
}
type CatalogMessageActionParameter struct {
ThumbnailProductRetailerId string `json:"thumbnail_product_retailer_id" validate:"required"`
}
type CatalogMessageApiPayload struct {
BaseMessagePayload
Interactive CatalogMessage `json:"interactive" validate:"required"`
}
type CatalogMessageBody struct {
Text string `json:"text" validate:"required"`
}
type CatalogMessageFooter struct {
Text string `json:"text" validate:"required"`
}
type CatalogMessageHeader struct {
Text string `json:"text" validate:"required"`
}
type Contact struct {
Name ContactName `json:"name" validate:"required"`
Org ContactOrg `json:"org,omitempty"`
Addresses []ContactAddress `json:"addresses,omitempty"`
Urls []ContactUrl `json:"urls,omitempty"`
Emails []ContactEmail `json:"emails,omitempty"`
Phones []ContactPhone `json:"phones,omitempty"`
Birthday string `json:"birthday,omitempty"`
}
func NewContact(name ContactName) *Contact
func (contact *Contact) AddEmail(params ContactEmail)
func (contact *Contact) AddPhone(params ContactPhone)
func (contact *Contact) AddUrl(params ContactUrl)
func (contact *Contact) SetBirthday(params string)
func (contact *Contact) SetFirstName(firstName string)
func (contact *Contact) SetLastName(lastName string)
func (contact *Contact) SetMiddleName(middleName string)
func (contact *Contact) SetOrg(params ContactOrg)
type ContactAddress struct {
Street string `json:"street,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Zip string `json:"zip,omitempty"`
Country string `json:"country,omitempty"`
CountryCode string `json:"countryCode,omitempty"`
Type AddressType `json:"type" validate:"required"`
}
type ContactEmail struct {
Email string `json:"email,omitempty"`
Type EmailType `json:"type,omitempty"`
}
type ContactMessage struct {
Contacts []Contact `json:"contacts" validate:"required"`
}
func NewContactMessage(configs []Contact) (*ContactMessage, error)
func (contact *ContactMessage) AddContact(params Contact)
func (m *ContactMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type ContactMessageApiPayload struct {
BaseMessagePayload
Contacts []Contact `json:"contacts" validate:"required"`
}
type ContactMessageConfigs struct {
Name string `json:"name" validate:"required"`
}
type ContactName struct {
FormattedName string `json:"formatted_name" validate:"required"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
MiddleName string `json:"middle_name,omitempty"`
Suffix string `json:"suffix,omitempty"`
Prefix string `json:"prefix,omitempty"`
}
type ContactOrg struct {
Company string `json:"company,omitempty"`
Title string `json:"title,omitempty"`
Department string `json:"department,omitempty"`
}
type ContactPhone struct {
Phone string `json:"phone,omitempty"`
WaId string `json:"wa_id,omitempty"`
Type PhoneType `json:"type" validate:"required"`
}
type ContactUrl struct {
Url string `json:"url" validate:"required"`
Type UrlType `json:"type" validate:"required"`
}
type Context struct {
MessageId string `json:"message_id,omitempty"`
}
type DocumentMessage struct {
Id string `json:"id,omitempty"`
Link *string `json:"link,omitempty"`
Caption *string `json:"caption,omitempty"`
FileName string `json:"filename" validate:"required"`
}
func NewDocumentMessage(params DocumentMessageConfigs) (*DocumentMessage, error)
func (dm *DocumentMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type DocumentMessageApiPayload struct {
BaseMessagePayload
Document DocumentMessage `json:"document" validate:"required"`
}
type DocumentMessageConfigs struct {
Id string `json:"id" validate:"required"`
Link *string `json:"link,omitempty"`
Caption *string `json:"caption,omitempty"`
FileName string `json:"filename" validate:"required"`
}
type EmailType string
const (
HomeEmail EmailType = "HOME"
WorkEmail EmailType = "WORK"
)
type ImageMessage struct {
Id string `json:"id,omitempty"`
Link string `json:"link,omitempty"`
Caption string `json:"caption,omitempty"`
}
func NewImageMessage(params ImageMessageConfigs) (*ImageMessage, error)
func (image *ImageMessage) SetCaption(params string)
func (image *ImageMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type ImageMessageApiPayload struct {
BaseMessagePayload
Image ImageMessage `json:"image" validate:"required"`
}
type ImageMessageConfigs = ImageMessage
type InteractiveMessageType string
const (
InteractiveMessageTypeButton InteractiveMessageType = "button"
InteractiveMessageTypeProduct InteractiveMessageType = "product"
InteractiveMessageTypeProductList InteractiveMessageType = "product_list"
InteractiveMessageTypeList InteractiveMessageType = "list"
InteractiveMessageTypeCatalog InteractiveMessageType = "catalog_message"
InteractiveMessageTypeLocationRequest InteractiveMessageType = "location_request_message"
)
type ListMessageApiPayload struct {
BaseMessagePayload
Interactive listMessage `json:"interactive" validate:"required"` // Interactive message.
}
type ListMessageBody struct {
Text string `json:"text" validate:"required"` // Text of the body.
}
type ListMessageFooter struct {
Text string `json:"text" validate:"required"` // Text of the footer.
}
type ListMessageHeader struct {
Type string `json:"type" validate:"required"` // Type of the header.
Text string `json:"text" validate:"required"` // Text of the header.
}
type ListMessageParams struct {
ButtonText string `json:"-" validate:"required"` // Text of the button.
BodyText string `json:"-" validate:"required"` // Text of the body.
}
type ListSection struct {
Title string `json:"title" validate:"required"` // Title of the section.
Rows []listSectionRow `json:"rows" validate:"required"` // Rows in the section.
}
func NewListSection(title string) (*ListSection, error)
func (section *ListSection) AddRow(row *listSectionRow)
func (section *ListSection) SetTitle(title string)
type LocationMessage struct {
Latitude float64 `json:"latitude" validate:"required"` // Latitude of the location
Longitude float64 `json:"longitude" validate:"required"` // Longitude of the location
Address string `json:"address,omitempty"` // Address of the location (optional)
Name string `json:"name,omitempty"` // Name of the location (optional)
}
func NewLocationMessage(latitude float64, longitude float64) (*LocationMessage, error)
func (location *LocationMessage) SetAddress(params string)
func (location *LocationMessage) SetName(params string)
func (location *LocationMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type LocationMessageApiPayload struct {
BaseMessagePayload
Location LocationMessage `json:"location" validate:"required"` // Location message
}
type LocationRequestMessage struct {
Type InteractiveMessageType `json:"type" validate:"required"` // Type of the message.
Action locationMessageAction `json:"action" validate:"required"` // Action of the message.
Body LocationRequestMessageBody `json:"body,omitempty"` // Body of the message.
}
func NewLocationRequestMessage(params LocationRequestMessageParams) (*LocationRequestMessage, error)
func (m *LocationRequestMessage) SetBodyText(bodyText string)
func (m *LocationRequestMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type LocationRequestMessageApiPayload struct {
BaseMessagePayload
Interactive LocationRequestMessage `json:"interactive" validate:"required"` // Interactive message.
}
type LocationRequestMessageBody struct {
Text string `json:"text" validate:"required"` // Text of the body.
}
type LocationRequestMessageParams struct {
BodyText string `json:"-" validate:"required"` // Text of the body.
}
type MessageType string
const (
MessageTypeLocation MessageType = "location"
MessageTypeAudio MessageType = "audio"
MessageTypeVideo MessageType = "video"
MessageTypeDocument MessageType = "document"
MessageTypeText MessageType = "text"
MessageTypeContact MessageType = "contacts"
MessageTypeInteractive MessageType = "interactive"
MessageTypeTemplate MessageType = "template"
MessageTypeReaction MessageType = "reaction"
MessageTypeSticker MessageType = "sticker"
MessageTypeImage MessageType = "image"
)
type Order struct {
CatalogID string `json:"catalog_id"` // CatalogID is the ID of the catalog associated with the order.
ProductItems []ProductItem `json:"product_items"` // ProductItems is a list of product items in the order.
Text *string `json:"text"` // Text is an additional text associated with the order.
}
type PhoneType string
const (
CellPhone PhoneType = "CELL"
MainPhone PhoneType = "MAIN"
IphonePhone PhoneType = "IPHONE"
HomePhone PhoneType = "HOME"
WorkPhone PhoneType = "WORK"
)
type Product struct {
RetailerId string `json:"product_retailer_id" validate:"required"`
}
func (p *Product) SetRetailerId(id string)
type ProductItem struct {
Currency string `json:"currency"` // Currency is the currency of the product item.
ItemPrice float64 `json:"item_price"` // ItemPrice is the price of the product item.
ProductRetailerID string `json:"product_retailer_id"` // ProductRetailerID is the ID of the retailer associated with the product item.
Quantity int `json:"quantity"` // Quantity is the quantity of the product item.
}
type ProductListMessage struct {
Action ProductListMessageAction `json:"action" validate:"required"`
Body ProductListMessageBody `json:"body" validate:"required"`
Footer *ProductListMessageFooter `json:"footer,omitempty"`
Header ProductListMessageHeader `json:"header,omitempty"`
Type InteractiveMessageType `json:"type" validate:"required"`
}
func NewProductListMessage(params ProductListMessageParams) (*ProductListMessage, error)
func (message *ProductListMessage) AddSection(section ProductSection)
func (message *ProductListMessage) SetBody(text string)
func (message *ProductListMessage) SetCatalogId(catalogId string)
func (message *ProductListMessage) SetFooter(text string)
func (message *ProductListMessage) SetHeader(text string)
func (message *ProductListMessage) SetProductRetailerId(productRetailerId string)
func (m *ProductListMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type ProductListMessageAction struct {
Sections []ProductSection `json:"sections" validate:"required"` // minimum 1 and maximum 10
CatalogId string `json:"catalog_id" validate:"required"`
ProductRetailerId string `json:"product_retailer_id" validate:"required"`
}
func (a *ProductListMessageAction) AddSection(section ProductSection)
type ProductListMessageApiPayload struct {
BaseMessagePayload
Interactive ProductListMessage `json:"interactive" validate:"required"`
}
type ProductListMessageBody struct {
Text string `json:"text" validate:"required"`
}
type ProductListMessageFooter struct {
Text string `json:"text" validate:"required"`
}
type ProductListMessageHeader struct {
Type ProductListMessageHeaderType `json:"type" validate:"required"`
Text string `json:"text" validate:"required"`
}
type ProductListMessageHeaderType string
const (
ProductListMessageHeaderTypeText ProductListMessageHeaderType = "text"
)
type ProductListMessageParams struct {
CatalogId string `validate:"required"`
ProductRetailerId string `validate:"required"`
BodyText string `validate:"required"`
Sections []ProductSection
}
type ProductMessage struct {
Type InteractiveMessageType `json:"type" validate:"required"`
Body *ProductMessageBody `json:"body" validate:"required"`
Footer *ProductMessageFooter `json:"footer,omitempty"`
Header *ProductMessageHeader `json:"header,omitempty"`
Action productMessageAction `json:"action" validate:"required"`
}
func NewProductMessage(params ProductMessageParams) (*ProductMessage, error)
func (m *ProductMessage) SetBody(text string)
func (m *ProductMessage) SetCatalogId(id string)
func (m *ProductMessage) SetFooter(text string)
func (m *ProductMessage) SetHeader(text string)
func (m *ProductMessage) SetProductRetailerId(id string)
func (m *ProductMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type ProductMessageApiPayload struct {
BaseMessagePayload
Interactive ProductMessage `json:"interactive" validate:"required"`
}
type ProductMessageBody struct {
Text string `json:"text" validate:"required"`
}
type ProductMessageFooter struct {
Text string `json:"text" validate:"required"`
}
type ProductMessageHeader struct {
Text string `json:"text" validate:"required"`
}
type ProductMessageParams struct {
CatalogId string `validate:"required"`
ProductRetailerId string `validate:"required"`
BodyText string `validate:"required"`
}
type ProductSection struct {
Title string `json:"title" validate:"required"`
Products []Product `json:"product_items" validate:"required"`
}
func (ps *ProductSection) AddProduct(product Product)
func (ps *ProductSection) SetTitle(title string)
type QuickReplyButtonMessage struct {
Type InteractiveMessageType `json:"type" validate:"required"` // Type of the quick reply button message.
Body QuickReplyButtonMessageBody `json:"body" validate:"required"` // Body of the quick reply button message.
Action QuickReplyButtonMessageAction `json:"action" validate:"required"` // Action of the quick reply button message.
Footer *QuickReplyButtonMessageFooter `json:"footer,omitempty"` // Footer of the quick reply button message.
Header *QuickReplyButtonMessageHeader `json:"header,omitempty"` // Header of the quick reply button message.
}
func NewQuickReplyButtonMessage(bodyText string) (*QuickReplyButtonMessage, error)
func (m *QuickReplyButtonMessage) AddButton(id, title string) error
func (m *QuickReplyButtonMessage) SetFooter(text string)
func (m *QuickReplyButtonMessage) SetHeader(text string)
func (m *QuickReplyButtonMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type QuickReplyButtonMessageAction struct {
Buttons []quickReplyButtonMessageButton `json:"buttons" validate:"required"` // List of quick reply buttons.
}
type QuickReplyButtonMessageApiPayload struct {
BaseMessagePayload
Interactive QuickReplyButtonMessage `json:"interactive" validate:"required"` // Interactive part of the API payload.
}
type QuickReplyButtonMessageBody struct {
Text string `json:"text" validate:"required"` // Text of the quick reply button message.
}
type QuickReplyButtonMessageFooter struct {
Text string `json:"text" validate:"required"` // Text of the quick reply button message footer.
}
type QuickReplyButtonMessageHeader struct {
Type string `json:"type" validate:"required"` // Type of the quick reply button message header.
Text string `json:"text" validate:"required"` // Text of the quick reply button message header.
}
type ReactionMessage struct {
MessageId string `json:"message_id" validate:"required"` // The ID of the message to react to.
Emoji string `json:"emoji" validate:"required"` // The emoji representing the reaction.
}
func NewReactionMessage(params ReactionMessageParams) (*ReactionMessage, error)
func (reaction *ReactionMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type ReactionMessageApiPayload struct {
BaseMessagePayload
Reaction ReactionMessage `json:"reaction" validate:"required"` // The reaction message.
}
type ReactionMessageParams = ReactionMessage
type StickerMessage struct {
Id string `json:"id,omitempty"`
Link string `json:"link,omitempty"`
}
func NewStickerMessage(params *StickerMessageConfigs) (*StickerMessage, error)
func (sticker *StickerMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type StickerMessageApiPayload struct {
BaseMessagePayload
Sticker StickerMessage `json:"sticker" validate:"required"`
}
type StickerMessageConfigs struct {
Id string `json:"id,omitempty"`
Link string `json:"link,omitempty"`
}
type TemplateMessage struct {
Name string `json:"name" validate:"required"` // Template name.
Language TemplateMessageLanguage `json:"language" validate:"required"` // Language configuration.
Components []TemplateMessageComponent `json:"components" validate:"required"` // Array of components.
}
func NewTemplateMessage(params *TemplateMessageConfigs) (*TemplateMessage, error)
func (tm *TemplateMessage) AddBody(params TemplateMessageComponentBodyType)
func (tm *TemplateMessage) AddButton(params TemplateMessageComponentButtonType) error
func (tm *TemplateMessage) AddHeader(params TemplateMessageComponentHeaderType)
func (m *TemplateMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type TemplateMessageApiPayload struct {
BaseMessagePayload
Template TemplateMessage `json:"template" validate:"required"`
}
type TemplateMessageBodyAndHeaderParameter struct {
Type TemplateMessageParameterType `json:"type" validate:"required"` // e.g., "text", "currency", etc.
ParameterName *string `json:"parameter_name,omitempty"` // Optional: name of the parameter (for named parameters).
Currency *TemplateMessageParameterCurrency `json:"currency,omitempty"` // Currency details (if type is currency).
DateTime *TemplateMessageParameterDateTime `json:"date_time,omitempty"` // Date/time details (if type is date_time).
Document *TemplateMessageParameterMedia `json:"document,omitempty"` // Document details (if type is document).
Image *TemplateMessageParameterMedia `json:"image,omitempty"` // Image details (if type is image).
Text *string `json:"text,omitempty"` // Text content (if type is text).
Video *TemplateMessageParameterMedia `json:"video,omitempty"` // Video details (if type is video).
Location *TemplateMessageParameterLocation `json:"location,omitempty"` // Location details (if type is location).
Product *TemplateMessageParameterProduct `json:"product,omitempty"` // Product details (if type is product).
}
func (t TemplateMessageBodyAndHeaderParameter) GetParameterType() string
type TemplateMessageButtonComponentType string
const (
TemplateMessageButtonComponentTypeQuickReply TemplateMessageButtonComponentType = "quick_reply"
TemplateMessageButtonComponentTypeUrl TemplateMessageButtonComponentType = "url"
TemplateMessageButtonComponentTypeCatalog TemplateMessageButtonComponentType = "catalog"
TemplateMessageButtonComponentTypeCopyCode TemplateMessageButtonComponentType = "copy_code"
TemplateMessageButtonComponentTypeMultiProductMessage TemplateMessageButtonComponentType = "mpm"
)
type TemplateMessageButtonParameter struct {
Type TemplateMessageButtonParameterType `json:"type" validate:"required"` // e.g., "payload" or "text" or "action"
Payload *string `json:"payload,omitempty"` // Required for quick_reply buttons.
Text *string `json:"text,omitempty"` // Required for URL buttons.
Action *TemplateMessageButtonParameterAction `json:"action,omitempty"` // Required for catalog buttons.
CouponCode *string `json:"coupon_code,omitempty"` // Required for copy code button in coupon_code parameter.
}
func (t TemplateMessageButtonParameter) GetParameterType() string
type TemplateMessageButtonParameterAction struct {
ThumbnailProductRetailerId string `json:"thumbnail_product_retailer_id" validate:"required"`
Sections *[]TemplateMessageMultiProductButtonActionParameterSection `json:"sections,omitempty"` // Required for MPM buttons. UPTO 10 sections in a buttons parameter
}
type TemplateMessageButtonParameterType string
const (
TemplateMessageButtonParameterTypePayload TemplateMessageButtonParameterType = "payload"
TemplateMessageButtonParameterTypeText TemplateMessageButtonParameterType = "text"
TemplateMessageButtonParameterTypeAction TemplateMessageButtonParameterType = "action"
TemplateMessageButtonParameterTypeCouponCode TemplateMessageButtonParameterType = "coupon_code"
)
type TemplateMessageCaraouselCard struct {
CardIndex int `json:"card_index" validate:"required"`
Components []TemplateMessageComponent `json:"components" validate:"required"` // only header, buttons and body
}
type TemplateMessageComponent interface {
GetComponentType() string
}
type TemplateMessageComponentBodyType struct {
Type TemplateMessageComponentType `json:"type" validate:"required"` // "body"
Parameters []TemplateMessageParameter `json:"parameters" validate:"required"` // Parameters for the body component.
}
func (t TemplateMessageComponentBodyType) GetComponentType() string
type TemplateMessageComponentButtonType struct {
Type TemplateMessageComponentType `json:"type" validate:"required"` // e.g., "button"
SubType TemplateMessageButtonComponentType `json:"sub_type" validate:"required"` // e.g., "quick_reply", "url", etc.
Index int `json:"index" validate:"required"` // Position index of the button (0 to 9)
Parameters *[]TemplateMessageParameter `json:"parameters,omitempty" validate:"required"` // Parameters for the button component.
}
func (t TemplateMessageComponentButtonType) GetComponentType() string
type TemplateMessageComponentCarouselType struct {
Type TemplateMessageComponentType `json:"type" validate:"required"` // "carousel"
Cards []TemplateMessageCaraouselCard `json:"cards" validate:"required"`
}
type TemplateMessageComponentHeaderType struct {
Type TemplateMessageComponentType `json:"type" validate:"required"` // "header"
Parameters *[]TemplateMessageParameter `json:"parameters,omitempty" validate:"required"` // Parameters for the header component.
}
func (t TemplateMessageComponentHeaderType) GetComponentType() string
type TemplateMessageComponentLimitedTimeOfferType struct {
Type TemplateMessageComponentType `json:"type" validate:"required"`
Parameters *[]TemplateMessageLimitedTimeOfferParameter `json:"parameters,omitempty" validate:"required"`
}
func (t TemplateMessageComponentLimitedTimeOfferType) GetComponentType() string
type TemplateMessageComponentType string
const (
TemplateMessageComponentTypeHeader TemplateMessageComponentType = "header"
TemplateMessageComponentTypeBody TemplateMessageComponentType = "body"
TemplateMessageComponentTypeButton TemplateMessageComponentType = "button"
TemplateMessageComponentTypeLimitedTimeOffer TemplateMessageComponentType = "limited_time_offer"
TemplateMessageComponentTypeCarousel TemplateMessageComponentType = "carousel"
)
type TemplateMessageConfigs struct {
Name string `json:"name" validate:"required"` // Template name.
Language string `json:"language" validate:"required"` // Language code.
}
type TemplateMessageLanguage struct {
Code string `json:"code" validate:"required"` // e.g., "en_US"
Policy string `json:"policy" validate:"required"` // e.g., "deterministic"
}
type TemplateMessageLimitedTimeOfferParameter struct {
Type TemplateMessageParameterType `json:"type" validate:"required"` // e.g., "text", "currency", etc.
LimitedTimeOffer struct {
ExpirationTimeMs int64 `json:"expiration_time_ms" validate:"required"` // Expiration time in milliseconds.
} `json:"limited_time_offer" validate:"required"`
}
type TemplateMessageMultiProductButtonActionParameterProductItem struct {
ProductRetailerId string `json:"product_retailer_id" validate:"required"`
}
type TemplateMessageMultiProductButtonActionParameterSection struct {
Title string `json:"title" validate:"required"`
// Upto 30 product items only
ProductItems []TemplateMessageMultiProductButtonActionParameterProductItem `json:"product_items" validate:"required"`
}
type TemplateMessageParameter interface {
GetParameterType() string
}
type TemplateMessageParameterCurrency struct {
FallbackValue string `json:"fallback_value" validate:"required"` // Default text if localization fails.
Code string `json:"code" validate:"required"` // ISO 4217 currency code.
Amount1000 int `json:"amount_1000" validate:"required"` // Amount multiplied by 1000.
}
type TemplateMessageParameterDateTime struct {
FallbackValue string `json:"fallback_value" validate:"required"` // Default text if localization fails.
}
type TemplateMessageParameterLocation struct {
Latitude string `json:"latitude" validate:"required"` // Latitude.
Longitude string `json:"longitude" validate:"required"` // Longitude.
Name string `json:"name" validate:"required"` // Location name.
Address string `json:"address" validate:"required"` // Address.
}
type TemplateMessageParameterMedia struct {
Link string `json:"link" validate:"required"` // URL link of the media.
}
type TemplateMessageParameterProduct struct {
ProductRetailerId string `json:"product_retailer_id" validate:"required"`
CatalogId string `json:"catalog_id" validate:"required"`
}
type TemplateMessageParameterType string
const (
TemplateMessageParameterTypeCurrency TemplateMessageParameterType = "currency"
TemplateMessageParameterTypeDateTime TemplateMessageParameterType = "date_time"
TemplateMessageParameterTypeDocument TemplateMessageParameterType = "document"
TemplateMessageParameterTypeImage TemplateMessageParameterType = "image"
TemplateMessageParameterTypeText TemplateMessageParameterType = "text"
TemplateMessageParameterTypeVideo TemplateMessageParameterType = "video"
TemplateMessageParameterTypeLocation TemplateMessageParameterType = "location"
TemplateMessageParameterTypeLimitedTimeOffer TemplateMessageParameterType = "limited_time_offer"
TemplateMessageParameterTypeProduct TemplateMessageParameterType = "product"
)
type TextMessageApiPayload struct {
BaseMessagePayload `json:",inline"`
Text TextMessageApiPayloadText `json:"text" validate:"required"` // The text content of the message.
}
type TextMessageApiPayloadText struct {
Body string `json:"body" validate:"required"` // The text content of the message.
AllowPreview bool `json:"preview_url,omitempty"` // Whether to allow preview of the message.
}
type TextMessageConfigs struct {
Text string `json:"text" validate:"required"` // The text content of the message.
AllowPreview bool `json:"allowPreview,omitempty"` // Whether to allow preview of the message.
}
type UrlType string
type VideoMessage struct {
Id string `json:"id,omitempty"`
Link string `json:"link,omitempty"`
Caption string `json:"caption,omitempty"`
}
func NewVideoMessage(params VideoMessageConfigs) (*VideoMessage, error)
func (video *VideoMessage) SetCaption(params string)
func (video *VideoMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type VideoMessageApiPayload struct {
BaseMessagePayload
Video VideoMessage `json:"video" validate:"required"`
}
type VideoMessageConfigs = VideoMessage
type listMessage struct {
Type InteractiveMessageType `json:"type" validate:"required"` // Type of the message.
Action listMessageAction `json:"action" validate:"required"` // Action of the message.
Body ListMessageBody `json:"body,omitempty"` // Body of the message.
Footer *ListMessageFooter `json:"footer,omitempty"` // Footer of the message.
Header *ListMessageHeader `json:"header,omitempty"` // Header of the message.
}
func NewListMessage(params ListMessageParams) (*listMessage, error)
func (m *listMessage) AddSection(section *ListSection)
func (m *listMessage) SetBodyText(section *ListSection)
func (m *listMessage) SetFooterText(footerText string)
func (m *listMessage) SetHeaderText(headerText string)
func (m *listMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)
type listMessageAction struct {
ButtonText string `json:"button" validate:"required"` // Text of the button.
Sections []ListSection `json:"sections" validate:"required"` // Sections in the list message.
}
type listSectionRow struct {
Id string `json:"id" validate:"required"` // ID of the row.
Description string `json:"description" validate:"required"` // Description of the row.
Title string `json:"title" validate:"required"` // Title of the row.
}
func NewListSectionRow(id, title, description string) (*listSectionRow, error)
func (row *listSectionRow) SetDescription(description string)
func (row *listSectionRow) SetId(id string)
func (row *listSectionRow) SetTitle(title string)
type locationMessageAction struct {
Name string `json:"name" validate:"required"` // Name of the action.
}
type productMessageAction struct {
CatalogId string `json:"catalog_id" validate:"required"`
ProductRetailerId string `json:"product_retailer_id" validate:"required"`
}
type quickReplyButtonMessageButton struct {
Type string `json:"type" validate:"required"` // Type of the quick reply button.
Reply quickReplyButtonMessageButtonReply `json:"reply" validate:"required"` // Reply structure of the quick reply button.
}
func NewQuickReplyButton(id, title string) (*quickReplyButtonMessageButton, error)
type quickReplyButtonMessageButtonReply struct {
Title string `json:"title" validate:"required"` // Title of the quick reply button.
Id string `json:"id" validate:"required"` // ID of the quick reply button.
}
type textMessage struct {
Text string // The text content of the message.
AllowPreview bool // Whether to allow preview of the message.
}
func NewTextMessage(configs TextMessageConfigs) (*textMessage, error)
func (m *textMessage) SetText(text string)
func (m *textMessage) ToJson(configs ApiCompatibleJsonConverterConfigs) ([]byte, error)