Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adjustment ¶
type Button ¶
type Button struct { Type ButtonType `json:"type"` Title string `json:"title,omitempty"` URL string `json:"url,omitempty"` Payload string `json:"payload,omitempty"` }
func NewAccountLinkButton ¶
NewAccountLinkButton creates a button used for account linking https://developers.facebook.com/docs/messenger-platform/account-linking/authentication
func NewAccountUnlinkButton ¶
func NewAccountUnlinkButton() Button
NewAccountUnlinkButton creates a button used for account unlinking https://developers.facebook.com/docs/messenger-platform/account-linking/authentication
func NewPhoneNumberButton ¶
NewPhoneNumberButton creates a button used in ButtonTemplate that upon clicking opens a native dialer
func NewPostbackButton ¶
NewPostbackButton creates a button used in ButtonTemplate that upon clicking sends a payload request to the server
func NewWebURLButton ¶
NewWebURLButton creates a button used in ButtonTemplate that redirects user to external address upon clicking the URL
type ButtonTemplate ¶
type ButtonTemplate struct { Text string `json:"text,omitempty"` Buttons []Button `json:"buttons,omitempty"` }
ButtonTemplate is a template
func (ButtonTemplate) SupportsButtons ¶
func (ButtonTemplate) SupportsButtons() bool
func (ButtonTemplate) Type ¶
func (ButtonTemplate) Type() TemplateType
type ButtonType ¶
type ButtonType string
ButtonType defines the behavior of the button in the ButtonTemplate
const ( ButtonTypeWebURL ButtonType = "web_url" ButtonTypePostback ButtonType = "postback" ButtonTypePhoneNumber ButtonType = "phone_number" ButtonTypeAccountLink ButtonType = "account_link" ButtonTypeAccountUnlink ButtonType = "account_unlink" )
type DefaultAction ¶
type DefaultActionGeneric ¶
type DefaultActionGeneric struct { Type ButtonType `json:"type,omitempty"` // Must be "web_url" URL string `json:"url,omitempty"` }
type GenericTemplate ¶
type GenericTemplate struct { // Title is limited to 45 characters Title string `json:"title"` ItemURL string `json:"item_url,omitempty"` ImageURL string `json:"image_url,omitempty"` DefaultActionGeneric *DefaultActionGeneric `json:"default_action,omitempty"` // Subtitle is limited to 80 characters Subtitle string `json:"subtitle,omitempty"` Buttons []Button `json:"buttons,omitempty"` }
func (GenericTemplate) SupportsButtons ¶
func (GenericTemplate) SupportsButtons() bool
func (GenericTemplate) Type ¶
func (GenericTemplate) Type() TemplateType
type ListButton ¶
type ListButton struct { Title string `json:"title"` Type string `json:"type",omitempty` URL string `json:"url",omitempty` MessengerExtensions bool `json:"messenger_extensions",omitempty` WebviewHeightRatio string `json:"webview_height_ratio",omitempty` FallbackURL string `json:"fallback_url",omitempty` }
type ListElement ¶
type ListElement struct { Title string `json:"title"` ImageURL string `json:"image_url,omitempty"` Subtitle string `json:"subtitle,omitempty"` DefaultAction `json:"default_action,omitempty"` Buttons []ListButton `json:"buttons,omitempty"` }
type ListTemplate ¶
type ListTemplate struct { Elements []ListElement `json:"elements"` Buttons []Button `json:"buttons,omitempty"` }
func (ListTemplate) SupportsButtons ¶
func (ListTemplate) SupportsButtons() bool
func (ListTemplate) Type ¶
func (ListTemplate) Type() TemplateType
type Payload ¶
type Payload struct {
Elements []Template `json:"elements"`
}
func (*Payload) MarshalJSON ¶
type ReceiptElement ¶
type ReceiptTemplate ¶
type ReceiptTemplate struct { RecipientName string `json:"recipient_name"` OrderNumber string `json:"order_number"` Currency string `json:"currency"` PaymentMethod string `json:"payment_method"` Timestamp string `json:"timestamp,omitempty"` OrderURL string `json:"order_url,omitempty"` Elements []ReceiptElement `json:"elements"` Address Address `json:"address,omitempty"` Summary Summary `json:"summary"` Adjustments []Adjustment `json:"adjustments,omitempty"` }
func (ReceiptTemplate) SupportsButtons ¶
func (ReceiptTemplate) SupportsButtons() bool
func (ReceiptTemplate) Type ¶
func (ReceiptTemplate) Type() TemplateType
type Template ¶
type Template interface { Type() TemplateType SupportsButtons() bool }
type TemplateType ¶
type TemplateType string
const TemplateTypeButton TemplateType = "button"
const TemplateTypeGeneric TemplateType = "generic"
const TemplateTypeList TemplateType = "list"
const TemplateTypeReceipt TemplateType = "receipt"