-
Notifications
You must be signed in to change notification settings - Fork 76
/
automation_workflows.go
182 lines (163 loc) Β· 5.76 KB
/
automation_workflows.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package gochimp3
type WorkflowType map[string]interface{}
type TimeToRun map[string]interface{}
// ------------------------------------------------------------------------------------------------
// TimeToRun
// ------------------------------------------------------------------------------------------------
func SendAsap(days []string, sendAsap bool) *TimeToRun {
return &TimeToRun{
"days": days,
"hours": map[string]bool{
"hours": sendAsap,
},
}
}
func SendBetween(days []string, start string, end string) *TimeToRun {
return &TimeToRun{
"days": days,
"hours": map[string]string{
"start": start,
"end": end,
},
}
}
func SendAt(days []string, sendAt string) *TimeToRun {
return &TimeToRun{
"days": days,
"hours": map[string]string{
"send_at": sendAt,
},
}
}
// ------------------------------------------------------------------------------------------------
// Workflows
// ------------------------------------------------------------------------------------------------
func WorkflowRecurringEvent(emailCount int, mergeFieldTrigger string, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "recurringEvent",
"runtime": runtime,
"workflow_emails_count": emailCount,
"merge_field_trigger": mergeFieldTrigger,
}
}
func WorkflowSpecialEvent(emailCount int, mergeFieldTrigger string, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "specialEvent",
"runtime": runtime,
"workflow_emails_count": emailCount,
"merge_field_trigger": mergeFieldTrigger,
}
}
func WorkflowDateAdded(emailCount int, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "dateAdded",
"runtime": runtime,
"workflow_emails_count": emailCount,
}
}
func WorkflowEmailFollowup(emailCount int, triggerOnImport, sendImmediately bool, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "emailFollowup",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"trigger_on_import": triggerOnImport,
}
}
func WorkflowEmailSeries(emailCount int, triggerOnImport, sendImmediately bool, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "emailSeries",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"trigger_on_import": triggerOnImport,
}
}
func WorkflowWelcomeSeries(emailCount int, triggerOnImport, sendImmediately bool, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "welcomeSeries",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"trigger_on_import": triggerOnImport,
}
}
func WorkflowMandrill(emailCount int, sendImmediately bool, mandrillTags []string, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "mandrill",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"mandrill_tags": mandrillTags,
}
}
func WorkflowVisitURL(emailCount int, sendImmediately bool, goalURL string, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "visitUrl",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"goal_url": goalURL,
}
}
func WorkflowBestCustomer(emailCount int, sendImmediately bool, lifetimePurchaseValue float64, purchaseOrders int, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "bestCustomer",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"lifetime_purchase_value": lifetimePurchaseValue,
"purchase_orders": purchaseOrders,
}
}
func WorkflowProductFollowup(emailCount int, sendImmediately bool, productName string, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "productFollowup",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"product_name": productName,
}
}
func WorkflowCategoryFollowup(emailCount int, sendImmediately bool, categoryName string, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "categoryFollowup",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"category_name": sendImmediately,
}
}
func WorkflowPurchaseFollowup(emailCount int, sendImmediately bool, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "purchaseFollowup",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
}
}
func WorkflowAPI(emailCount int, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "api",
"runtime": runtime,
"workflow_emails_count": emailCount,
}
}
func WorkflowGroupAdd(emailCount int, sendImmediately bool, groupID int, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "groupAdd",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"group_id": groupID,
}
}
func WorkflowGroupRemove(emailCount int, sendImmediately bool, groupID int, runtime TimeToRun) *WorkflowType {
return &WorkflowType{
"workflow_type": "groupRemove",
"runtime": runtime,
"workflow_emails_count": emailCount,
"send_immediately": sendImmediately,
"group_id": groupID,
}
}