File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,16 @@ def _generate_acoustic_report(
101
101
"Last Modified Date" ,
102
102
]
103
103
104
+ SUPPRESSION_COLUMNS = [
105
+ "Email" ,
106
+ "Opt In Date" ,
107
+ "Opted Out" ,
108
+ "Opt In Details" ,
109
+ "Email Type" ,
110
+ "Opted Out Date" ,
111
+ "Opt Out Details" ,
112
+ ]
113
+
104
114
REPORTS_CONFIG = {
105
115
"raw_recipient_export" : {
106
116
"request_template" : """
@@ -156,6 +166,39 @@ def _generate_acoustic_report(
156
166
),
157
167
},
158
168
},
169
+ "suppression_export" : {
170
+ "request_template" : """
171
+ <!-- https://developer.goacoustic.com/acoustic-campaign/reference/export-from-a-database -->
172
+ <!-- date_format: 07/25/2011 12:12:11 (time is optional) -->
173
+ <Envelope>
174
+ <Body>
175
+ <ExportList>
176
+ <LIST_ID>{list_id}</LIST_ID>
177
+ <EXPORT_TYPE>{export_type}</EXPORT_TYPE>
178
+ <EXPORT_FORMAT>{export_format}</EXPORT_FORMAT>
179
+ <INCLUDE_RECIPIENT_ID></INCLUDE_RECIPIENT_ID>
180
+ <EXPORT_COLUMNS>
181
+ {columns}
182
+ </EXPORT_COLUMNS>
183
+ <DATE_START>{date_start}</DATE_START>
184
+ <DATE_END>{date_end}</DATE_END>
185
+ <VISIBILITY>{visibility}</VISIBILITY>
186
+ </ExportList>
187
+ </Body>
188
+ </Envelope>
189
+ """ ,
190
+ "request_params" : {
191
+ "list_id" : "{{ var.value.fivetran_acoustic_suppression_export_list_id }}" , # list_name: "MAIN SUPPRESSION LIST - All"
192
+ "export_type" : "ALL" ,
193
+ "export_format" : "CSV" ,
194
+ "visibility" : 1 , # 0 (Private) or 1 (Shared)
195
+ "date_start" : EXEC_START ,
196
+ "date_end" : EXEC_END ,
197
+ "columns" : "\n " .join (
198
+ [f"<COLUMN>{ column } </COLUMN>" for column in SUPPRESSION_COLUMNS ]
199
+ ),
200
+ },
201
+ },
159
202
}
160
203
161
204
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ def generate_report(
153
153
supported_report_types = (
154
154
"raw_recipient_export" ,
155
155
"contact_export" ,
156
+ "suppression_export" ,
156
157
)
157
158
if report_type not in supported_report_types :
158
159
err_msg = f"{ report_type } is not a valid option, supported types are: { supported_report_types } "
@@ -183,6 +184,9 @@ def generate_report(
183
184
report_loc = data ["Envelope" ]["Body" ]["RESULT" ]["FILE_PATH" ]
184
185
elif report_type == "raw_recipient_export" :
185
186
job_id , report_loc = data ["Envelope" ]["Body" ]["RESULT" ]["MAILING" ].values ()
187
+ elif report_type == "suppression_export" :
188
+ job_id = data ["Envelope" ]["Body" ]["RESULT" ]["JOB_ID" ]
189
+ report_loc = data ["Envelope" ]["Body" ]["RESULT" ]["FILE_PATH" ]
186
190
187
191
while not self ._is_job_complete (job_id = job_id , extra_info = report_type ):
188
192
sleep (sleep_delay )
You can’t perform that action at this time.
0 commit comments