-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebhooks.go
110 lines (101 loc) · 2.84 KB
/
webhooks.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package postmark
import (
"time"
)
// BounceWebhook defines the format of a webhook sent after an email bounced
// http://developer.postmarkapp.com/developer-bounce-webhook.html#data
type BounceWebhook struct {
// you can use the ID to make different requests to the Bounce API.
ID int64
// the classification that Postmark assigned the bounce.
Type string
TypeCode int64
Name string
Tag string
MessageID string
Description string
Details string
// the email address that bounced.
Email string
BouncedAt time.Time
DumpAvailable bool
// lets you know if this bounce caused the email address to be deactivated.
Inactive bool
// lets you know if this address can be activated again.
CanActivate bool
Subject string
}
// InboundWebhook defines the format of a webhook sent in response to an inbound email.
// http://developer.postmarkapp.com/developer-inbound-webhook.html#data
type InboundWebhook struct {
FromName string
From string
FromFull InboundEntity
To string
ToFull []InboundEntity
Cc string
CcFull []InboundEntity
Bcc string
BccFull []InboundEntity
OriginalRecipient string
Subject string
MessageID string
ReplyTo string
MailboxHash string
Date string
TextBody string
HTMLBody string `json:"HtmlBody"`
StrippedTextReply string
Tag string
Headers []InboundHeader
Attachments []InboundAttachment
}
// InboundEntity is an entity associated with an inbound webhook.
type InboundEntity struct {
Email string
Name string
MailboxHash string
}
// InboundHeader is a header associated with an inbound webhook.
type InboundHeader struct {
Name string
Value string
}
// InboundAttachment is an attachment associated with an inbound webhook.
type InboundAttachment struct {
Name string
Content string
ContentType string
ContentLength int64
}
// OpenWebhook defines the format of a webhook sent in response to the opening of an email.
// http://developer.postmarkapp.com/developer-open-webhook.html#data
type OpenWebhook struct {
FirstOpen bool
Client OpenContext
OS OpenContext
Platform string
UserAgent string
ReadSeconds float64
Geo OpenGeolocation
MessageID string
ReceivedAt Time
Tag string
Recipient string
}
// OpenContext defines the context within which an open occurred.
type OpenContext struct {
Name string
Company string
Family string
}
// OpenGeolocation defines the geolocation for the opening of an email.
type OpenGeolocation struct {
CountryISOCode string
Country string
Region string
City string
Zip string
Coords string
IP string
}