@@ -12,8 +12,11 @@ import (
1212type Properties map [string ]map [string ]interface {}
1313
1414type postback struct {
15- ID string `json:"id"`
16- Toggled bool `json:"toggled"`
15+ ID string `json:"id"`
16+ Toggled bool `json:"toggled"`
17+ ButtonType string `json:"button_type,omitempty"`
18+ ButtonValue string `json:"button_value,omitempty"`
19+ Ecommerce * PostbackEcommerce `json:"ecommerce,omitempty"`
1720}
1821
1922type ban struct {
@@ -52,6 +55,12 @@ type TransferChatOptions struct {
5255 IgnoreAgentsAvailability bool
5356}
5457
58+ type PostbackEcommerce struct {
59+ ProductID string `json:"product_id,omitempty"`
60+ OptionID string `json:"option_id,omitempty"`
61+ Quantity int `json:"quantity,omitempty"`
62+ }
63+
5564// User represents base of both Customer and Agent
5665//
5766// To get specific user type's structure, call Agent() or Customer() (based on Type value).
@@ -704,11 +713,12 @@ func (f *FilledFormField) GroupChooser() *FilledFormFieldGroupChooser {
704713
705714// Postback represents postback data in LiveChat message event.
706715type Postback struct {
707- ID string `json:"id"`
708- ThreadID string `json:"thread_id"`
709- EventID string `json:"event_id"`
710- Type string `json:"type,omitempty"`
711- Value string `json:"value,omitempty"`
716+ ID string `json:"id"`
717+ ThreadID string `json:"thread_id"`
718+ EventID string `json:"event_id"`
719+ Type string `json:"type,omitempty"`
720+ Value string `json:"value,omitempty"`
721+ Ecommerce * PostbackEcommerce `json:"ecommerce,omitempty"`
712722}
713723
714724// Message represents LiveChat message event.
@@ -828,10 +838,11 @@ type RichMessage struct {
828838
829839// RichMessageElement represents element of LiveChat rich message
830840type RichMessageElement struct {
831- Buttons []RichMessageButton `json:"buttons"`
832- Title string `json:"title"`
833- Subtitle string `json:"subtitle"`
834- Image * RichMessageImage `json:"image,omitempty"`
841+ Buttons []RichMessageButton `json:"buttons"`
842+ Title string `json:"title"`
843+ Subtitle string `json:"subtitle"`
844+ Image * RichMessageImage `json:"image,omitempty"`
845+ Ecommerce * RichMessageEcommerce `json:"ecommerce,omitempty"`
835846}
836847
837848// RichMessageButton represents button in LiveChat rich message
@@ -858,6 +869,35 @@ type RichMessageImage struct {
858869 AlternativeText string `json:"alternative_text,omitempty"`
859870}
860871
872+ // RichMessageImage represents ecommerce element in LiveChat rich message
873+ type RichMessageEcommerce struct {
874+ ProductID string `json:"product_id"`
875+ Label string `json:"label"`
876+ ViewType string `json:"view_type"`
877+ Options []RichMessageEcommerceOption `json:"options,omitempty"`
878+ Addons []RichMessageEcommerceAddon `json:"addons,omitempty"`
879+ }
880+
881+ type RichMessageEcommerceOption struct {
882+ OptionID string `json:"option_id"`
883+ Label string `json:"label"`
884+ Price string `json:"price,omitempty"`
885+ RegularPrice string `json:"regular_price,omitempty"`
886+ Currency string `json:"currency,omitempty"`
887+ Color string `json:"color,omitempty"`
888+ ImageURL string `json:"image_url,omitempty"`
889+ ImageThumbnailURL string `json:"image_thumbnail_url,omitempty"`
890+ Available * bool `json:"available,omitempty"`
891+ Selected * bool `json:"selected,omitempty"`
892+ }
893+
894+ type RichMessageEcommerceAddon struct {
895+ AddonType string `json:"addon_type"`
896+ RangeFrom string `json:"range_from,omitempty"`
897+ RangeTo string `json:"range_to,omitempty"`
898+ Currency string `json:"currency,omitempty"`
899+ }
900+
861901// RichMessage function converts Event object to RichMessage object if Event's Type is "rich_message".
862902// If Type is different or Event is malformed, then it returns nil.
863903func (e * Event ) RichMessage () * RichMessage {
0 commit comments