Reports on unsubscribes and bad addresses for a group of customers
Usage
# S3 method for class 'unsubscribe_report'
read(unsubscribe_report, customers, ...)
# S3 method for class 'unsubscribe_report'
process(unsubscribe_report, ...)
# S3 method for class 'unsubscribe_report'
output(
unsubscribe_report,
since = Sys.Date() - 30,
until = Sys.Date() + 30,
routing_rules = list(TRUE ~ list(config::get("tessiflow.email"))),
name = "contact_warning",
subject = paste("Contact warning report for", Sys.Date()),
...
)
Arguments
- unsubscribe_report
unsubscribe_report object
- customers
integer vector of customer numbers to load
- ...
not used
- since
date, start date for filtering the returned data
- until
date, end date for filtering the returned data
- routing_rules
list of formulas to be used for routing, as for dplyr::case_when. Can refer to any columns returned by process.unsubscribe_report. See Note below
- name
name of the file to use in the email. Defaults to the name of the table or the inputted filename. A timestamp and extension will be appended and passed on to send_email as the name of
attachments
.- subject
character subject of the email
Methods (by generic)
read(unsubscribe_report)
: reads unsubscribe_report data Loads data fromp2: unsubscribes and hard bounces by list (uses p2_stream_enriched from tessistream)
tessi: emails, addresses, logins, memberships, constituencies, MGOs (attributes)
process(unsubscribe_report)
: process unsubscribe_report dataChecks if emails are unsubscribed, bounced, or don't exist
Checks if mailing addresses have a NCOA flag or don't exist
Checks if the customer primary login doesn't match the primary email
Checks if customers are inactive
Adds identifying info: MGO, constituencies, membership expiration date and level
output(unsubscribe_report)
: send the unsubscribe_report as emails to MGOsData is filtered so that all events after
since
are returned and all events for members with expiration dates betweensince
anduntil
are returned
Note
For example, this value for routing_rules:
list(grepl("GOV", constituencies) ~ list("eleszynski@bam.org"),
grepl("CP\\d", constituencies) ~ list("lmcgee@bam.org"),
grepl("\\+",constituencies) ~ list(c("apratama@bam.org","jhindle@bam.org")),
TRUE ~ list(c("kburke@bam.org","esearles@bam.org")))
Routes based on the following rules:
GOV -> send to Government Affairs (eleszynski)
CP# -> send to Strategic Partnerships (lmcgee)
??+ -> send to Patron Program (apratama and jhindle)
Other -> send to Dev Ops (kburke and esearles)
Examples
if (FALSE) { # \dontrun{
run(unsubscribe_report,
customers = c(1,2,3),
routing_rules = list(grepl("GOV", constituencies) ~ list("eleszynski@bam.org"),
grepl("CP\\d", constituencies) ~ list("lmcgee@bam.org"),
grepl("\\+",constituencies) ~ list(c("apratama@bam.org","jhindle@bam.org")),
TRUE ~ list(c("kburke@bam.org","esearles@bam.org"))))
} # }