From 3b5ffe23430a857a44087078b1b3f00929871225 Mon Sep 17 00:00:00 2001 From: Maria Tyschitskaya Date: Tue, 2 Nov 2021 15:11:36 +0300 Subject: [PATCH] add postback payload description in message --- message.go | 11 +++++++++-- receiving.go | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/message.go b/message.go index 233ffa2..f2564ba 100644 --- a/message.go +++ b/message.go @@ -130,12 +130,19 @@ type PostBack struct { Recipient Recipient `json:"-"` // Time is when the message was sent. Time time.Time `json:"-"` - // PostBack ID - Payload string `json:"payload"` + // PostBack Payload + Payload PostBackPayload `json:"payload"` // Optional referral info Referral Referral `json:"referral"` } +// PostBackPayload represents payload data in PostBack +type PostBackPayload struct { + Title string `json:"title"` + Payload string `json:"payload"` + Mid string `json:"mid"` +} + type AccountLinking struct { // Sender is who the message was sent from. Sender Sender `json:"-"` diff --git a/receiving.go b/receiving.go index f08a46f..2c6a05f 100644 --- a/receiving.go +++ b/receiving.go @@ -117,20 +117,20 @@ type Payload struct { URL string `json:"url,omitempty"` Title string `json:"title,omitempty"` // Coordinates is Lat/Long pair of location pin - Coordinates *Coordinates `json:"coordinates,omitempty"` - TemplateType string `json:"template_type,omitempty"` - Buttons []Button `json:"buttons,omitempty"` + Coordinates *Coordinates `json:"coordinates,omitempty"` + TemplateType string `json:"template_type,omitempty"` + Buttons []Button `json:"buttons,omitempty"` } type Button struct { - Type string `json:"type,omitempty"` - Title string `json:"title,omitempty"` - Payload string `json:"payload,omitempty"` - URL string `json:"url,omitempty"` - WebviewHeightRatio string `json:"webview_height_ratio,omitempty"` - MessengerExtensions bool `json:"messenger_extensions,omitempty"` - FallbackURL string `json:"fallback_url,omitempty"` - WebviewShareButton string `json:"webview_share_button,omitempty"` + Type string `json:"type,omitempty"` + Title string `json:"title,omitempty"` + Payload string `json:"payload,omitempty"` + URL string `json:"url,omitempty"` + WebviewHeightRatio string `json:"webview_height_ratio,omitempty"` + MessengerExtensions bool `json:"messenger_extensions,omitempty"` + FallbackURL string `json:"fallback_url,omitempty"` + WebviewShareButton string `json:"webview_share_button,omitempty"` } // Coordinates is a pair of latitude and longitude.