-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathincoming.go
92 lines (78 loc) · 2.03 KB
/
incoming.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package fbbot
// Message represents a message sent to your page.
type Message struct {
ID string
Page Page
Sender User
Text string
IsEcho bool
AppID int64
Images []Image
Videos []Video
Audios []Audio
Files []File
Location Location
Seq int
Timestamp int64
Quickreply Quickreply
}
type Quickreply struct {
Payload string
}
type Image struct {
URL string
StickerID int64
}
type Video struct {
URL string
}
type Audio struct {
URL string
}
type File struct {
URL string
}
type Location struct {
Coordinates Coordinates
}
type Coordinates struct {
Lat float64
Long float64
}
// Postback
type Postback struct {
Sender User
Payload string `json:"payload"`
}
// Delivery
// This callback will occur when a message a page has sent has been delivered.
type Delivery struct {
MessageIDs []string `json:"mids"` // Slice containing message IDs of messages that were delivered. Field may not be present.
Watermark float64 `json:"watermark"` // All messages that were sent before this timestamp were delivered
Seq int `json:"seq"` // Sequence number
}
// Optin
// This callback will occur when the Send-to-Messenger plugin has been tapped.
type Optin struct {
Sender User
Ref string `json:"ref"` // data-ref parameter that was defined with the entry point
}
// Read
// This callback will occur when a message a page has sent has been read by the user.
type Read struct {
Sender User
Watermark float64 `json:"watermark"` // All messages that were sent before this timestamp were read
Seq int `json:"seq"` // Sequence number
}
// Payment
// TODO: Payment is still in BETA. Implement later.
// Doc: https://developers.facebook.com/docs/messenger-platform/webhook-reference/payment
type Payment struct {
Sender User
}
// Checkout update
// TODO: Checkout Update is still in BETA. Implement later.
// Document: https://developers.facebook.com/docs/messenger-platform/webhook-reference/checkout-update
type CheckoutUpdate struct {
Sender User
}