Documentation
¶
Overview ¶
Package readiness is Send Readiness (spec 5.1, 7.5): every check a campaign must pass before it goes out, each Pass, Warn, Block or Unknown with its evidence and a fix, plus the estimates around the send (final audience, route, cost and duration, throttling per mailbox provider).
A run gathers facts from the other domains and Assemble turns them into checks. Assemble is pure, so the demo seeds runs through it and tests feed it fixtures. Runs are stored in readiness_runs; the run in progress is in readiness_progress so the review screen can tick the groups in.
Index ¶
- Constants
- Variables
- func AddLinkParam(src, param, value string) (string, int)
- func ArgAnd[T any](items []T) map[string]any
- func ArgDay(t time.Time) map[string]any
- func ArgDayMonth(t time.Time) map[string]any
- func ArgDayMonthTime(t time.Time) map[string]any
- func ArgDayTime(t time.Time) map[string]any
- func ArgLanguage(code string) map[string]any
- func ArgMoney(v float64) map[string]any
- func ArgOr[T any](items []T) map[string]any
- func ArgPercent(v float64) map[string]any
- func ArgPercent1(v float64) map[string]any
- func ArgTime(t time.Time) map[string]any
- func AudienceDigest(raw json.RawMessage) string
- func Clock(t, now time.Time, loc *time.Location) string
- func Count(n int64) string
- func DismissedKeys(run ReadinessRun) []string
- func EncodeResult(res ReadinessResult) (checks, estimates json.RawMessage, err error)
- func Fingerprint(c store.ReadinessCampaignRow, routing json.RawMessage) string
- func GroupTitle(g string) string
- func HTMLOnly(mjmlSrc, html string) bool
- func InsertFooter(src, address string) (string, bool)
- func InsertFooterIn(l i18n.Lang, src, address string) (string, bool)
- func JoinAnd(items []string) string
- func LookupFailed(a dnscheck.DomainAuth) bool
- func MailboxName(k string) string
- func MarkDismissed(run *ReadinessRun, d map[string]campaigns.ComposerDismissal)
- func Minutes(seconds float64) int
- func Money(v float64) string
- func Pct(v float64) string
- func Pct1(v float64) string
- func Per1000(v float64) string
- func Plural(n int64, one, many string) string
- func ProviderDataOnly(checks []ReadinessCheck) bool
- func Rate(v float64) string
- func Register(h huma.API, s *Service)
- func Relookup(ctx context.Context, r dnscheck.Resolver, domain string, ...) dnscheck.DomainAuth
- func ReplaceLink(src, from, to string) (string, int)
- func RoutingKey(ctx context.Context, q *store.Queries, wsID uuid.UUID) json.RawMessage
- func RunningText(g string) string
- func ShareStatusIn(english string, kept Text, status string, day, days int, l i18n.Lang) string
- func SplitLabelIn(english string, l i18n.Lang) string
- func ThresholdsLine(t ReadinessThresholds) string
- func WithLanguages(fingerprint, digest string) string
- func WithoutTexts(raw json.RawMessage) json.RawMessage
- type A
- type AccessibilityChecker
- type AfterChange
- type AudienceDef
- type AudienceFacts
- type AuthFacts
- type CampaignFacts
- type ComplianceFacts
- type ComposerReadiness
- type ComposerReadinessGroup
- type ConditionalChecker
- type ConditionalFacts
- type ConfirmFacts
- type Confirmation
- type ContentFacts
- type Deliverability
- type Digests
- type DomainAssetFacts
- type DownFacts
- type EndedUpgradeOffer
- type Estimator
- type Facts
- type FallbackFacts
- type FieldUse
- type GrowChecker
- type GrowLink
- type GrowRow
- type JobInserter
- type LanguagesFacts
- type ListingFacts
- type MailboxClassifier
- type PaidAudienceFacts
- type PollFacts
- type PostmasterFacts
- type ProviderAuthFacts
- type ReadinessABTimeline
- type ReadinessAudience
- type ReadinessAudienceRow
- type ReadinessCampaignPath
- type ReadinessCheck
- type ReadinessCheckRow
- type ReadinessConfirm
- type ReadinessCounts
- type ReadinessDismissal
- type ReadinessEstimates
- type ReadinessFix
- type ReadinessFixBatch
- type ReadinessFixOutcome
- type ReadinessFixRequest
- type ReadinessFixResult
- type ReadinessFixesInput
- type ReadinessGroup
- type ReadinessHeldMove
- type ReadinessPoll
- type ReadinessProgress
- type ReadinessProgressGroup
- type ReadinessResult
- type ReadinessRoute
- type ReadinessRouteShare
- type ReadinessRun
- type ReadinessRunFailure
- type ReadinessRunRef
- type ReadinessSchedule
- type ReadinessSendSettings
- type ReadinessTechRow
- type ReadinessThresholds
- type ReadinessThrottle
- type ReadinessTimeline
- type ReadinessUndoOutcome
- type ReadinessUndoResult
- type Recipient
- type ReputationFacts
- type RetryAudienceFacts
- type ReverseDNSFacts
- type RouteConfig
- type RouteFacts
- type RouteOverride
- type RouteShareRef
- type RuleFacts
- type RunArgs
- type RunOptions
- type RunWorker
- type Schedule
- type SegmentResolver
- type SendDefaults
- type SendHold
- type SendTimeCheck
- type SendingRule
- type SendingRuleInput
- type SendingRuleTrigger
- type SendingRulesView
- type Service
- func (s *Service) AcceptUnknown(ctx context.Context, ws *store.Workspace, p *authz.Principal, ...) (ReadinessRun, error)
- func (s *Service) ApplyFixes(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (ReadinessFixResult, error)
- func (s *Service) Audience(ctx context.Context, ws *store.Workspace, raw json.RawMessage) (AudienceFacts, error)
- func (s *Service) Campaign(ctx context.Context, ws *store.Workspace, id uuid.UUID) (store.ReadinessCampaignRow, error)
- func (s *Service) Confirm(ctx context.Context, q *store.Queries, ws *store.Workspace, ...) error
- func (s *Service) Confirmed(ctx context.Context, campaignID uuid.UUID) (*Confirmation, error)
- func (s *Service) CreateSendingRule(ctx context.Context, ws *store.Workspace, p *authz.Principal, ...) (SendingRule, error)
- func (s *Service) CurrentFingerprint(ctx context.Context, ws *store.Workspace, c store.ReadinessCampaignRow) string
- func (s *Service) DeleteSendingRule(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) error
- func (s *Service) Digests(ctx context.Context, ws *store.Workspace, c store.ReadinessCampaignRow) Digests
- func (s *Service) Dismissed(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, ...) error
- func (s *Service) Forget(ctx context.Context, q *store.Queries, campaignID uuid.UUID) error
- func (s *Service) Get(ctx context.Context, campaignID, runID uuid.UUID) (*ReadinessRun, error)
- func (s *Service) Latest(ctx context.Context, campaignID uuid.UUID) (*ReadinessRun, error)
- func (s *Service) Poll(ctx context.Context, campaignID uuid.UUID) (ReadinessPoll, error)
- func (s *Service) Progress(ctx context.Context, campaignID uuid.UUID) (*ReadinessProgress, error)
- func (s *Service) Route(ctx context.Context, ws *store.Workspace, override json.RawMessage) (RouteConfig, error)
- func (s *Service) Run(ctx context.Context, ws *store.Workspace, id uuid.UUID, o RunOptions) (ReadinessRun, error)
- func (s *Service) SaveSendDefaults(ctx context.Context, ws *store.Workspace, p *authz.Principal, in SendDefaults) (SendingRulesView, error)
- func (s *Service) SendingRules(ctx context.Context, ws *store.Workspace, p *authz.Principal) (SendingRulesView, error)
- func (s *Service) SetCanary(ctx context.Context, q *store.Queries, campaignID uuid.UUID, choice string) error
- func (s *Service) Start(ctx context.Context, ws *store.Workspace, id uuid.UUID, o RunOptions) (*ReadinessProgress, error)
- func (s *Service) State(ctx context.Context, campaignID uuid.UUID) (*ReadinessProgress, *ReadinessRunFailure, error)
- func (s *Service) UndoFixes(ctx context.Context, ws *store.Workspace, p *authz.Principal, ...) (ReadinessUndoResult, error)
- func (s *Service) UndoableFixes(ctx context.Context, c store.ReadinessCampaignRow) (*ReadinessFixBatch, error)
- func (s *Service) UpdateSendSettings(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) error
- func (s *Service) UpdateSendingRule(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, ...) (SendingRule, error)
- func (s *Service) Work(ctx context.Context, a RunArgs) error
- type ShareFacts
- type SponsorChecker
- type SponsorFacts
- type Text
- type UpgradeOfferChecker
- type VariantReport
- type VerificationChecker
- type VerificationFacts
- type VersionReport
- type WebCheck
- type WebFacts
- type WebsiteChecker
Constants ¶
const ( FixAccessibilityDecorative = accessibility.ActionDecorative FixAccessibilityColor = accessibility.ActionColor FixAccessibilityOneClick = accessibility.ActionOneClick )
Fix actions of the Accessibility group.
const ( UnengagedWarnCount = 500 )
UnengagedWarnShare and UnengagedWarnCount decide when unengaged contacts are worth a warning: 1% of the audience or 500 contacts.
const ( FixVisibilityShowEveryone = visibility.FixShowEveryone FixVisibilityHideBlock = visibility.FixHideBlock FixVisibilityRemoveCondition = visibility.FixRemoveCondition FixPollCloseDays = polls.FixCloseDays )
Fix actions of conditional content and polls.
const ( BaseAll = "all" // every public list: "All subscribers" BaseList = "list" // one list: "Weekly Digest list" BaseSegment = "segment" // one segment: "Customers segment" BaseNone = "none" // nothing named: "Audience" BaseMany = "many" // several: "Weekly Digest + Product Updates" )
Kinds of audience a base label names (AudienceFacts.BaseKind).
const ( DomainSending = "sending" // news.acme.io, the From address's domain DomainParent = "parent" // acme.io, its organizational domain DomainReturnPath = "return_path" // bounce.news.acme.io, a provider's custom MAIL FROM DomainTracking = "tracking" // the domain of the open pixel and the tracked links )
Roles of the domains a send's reputation rides on (DomainAssetFacts.Role).
const ( AuthCNAMEs = "cnames" // CNAMEs Easy DKIM CNAMEs verified AuthSelector = "selector" // selector Selector verified AuthUnverified = "unverified" // DKIM records not verified AuthSPFAdd = "spf_add" // add Value to the SPF record of Name )
What a provider's record detail says (ProviderAuthFacts.DetailKind).
const ( PostmasterFloor = 98.0 PostmasterSpamLimit = 0.3 )
PostmasterFloor is the pass rate (percent) under which Gmail Postmaster's authentication and TLS rates make its compliance status "Needs work", and PostmasterSpamLimit the user-reported spam rate at which it does (Google's bulk-sender rules, SR-12).
const ( TroubleTimeout = "timeout" // no server answered in time TroubleServFail = "servfail" // the server answered SERVFAIL TroubleRefused = "refused" // the server refused the query TroubleOther = "other" // no usable answer )
Kinds of DNS trouble (ProviderAuthFacts.Trouble), so the evidence says what happened in each reader's language.
const ( FixMarkLanguageUpToDate = "mark_language_up_to_date" FixMarkLanguageTranslated = "mark_language_translated" FixHoldLanguage = "hold_language" FixReleaseLanguage = "release_language" )
Fix actions of the Languages group.
const ( RuleLinkParam = "link_param" RuleLinkDomain = "link_domain" RuleSubjectLength = "subject_length" RuleContainsText = "contains_text" )
What a rule checks, and how.
const ( HoldBlocked = "blocked" // a check blocks HoldNewWarning = "new_warning" // a warning nobody confirmed HoldUnknown = "unknown" // a check couldn't run, and nobody chose to send without it HoldAudience = "audience_change" // the audience changed by more than AudienceChangeLimit HoldEdited = "edited" // the content, audience, sender or route changed after scheduling )
Why a send is held (SendHold.Kind).
const ( FixSponsorRemove = "sponsor_remove_block" FixSponsorRefresh = "sponsor_refresh_block" )
Fix actions of the Sponsor block.
const ( VerdictReady = "ready" VerdictWarnings = "warnings" VerdictBlocked = "blocked" )
Verdicts.
const ( Pass = "pass" Warn = "warn" Block = "block" Unknown = "unknown" )
Check statuses.
const ( GroupReputation = "reputation" GroupAuthentication = "authentication" GroupContent = "content" GroupLinks = "links" GroupCompliance = "compliance" GroupAudience = "audience" GroupRouting = "routing" )
Check groups, in the order of the checklist.
const ( TriggerManual = "manual" TriggerComposer = "composer" TriggerSchedule = "schedule" TriggerSendTime = "send_time" TriggerApproval = "approval" )
Triggers of a run (readiness_runs.trigger).
const ( FixExcludeSunset = "exclude_sunset" // FixIncludeUnengaged puts back the unengaged contacts a send leaves // out ("Include them" on the audience, SR-11). FixIncludeUnengaged = "include_unengaged" FixRouteOnly = "route_only" FixReplaceLink = "replace_link" FixUseSubject = "use_subject" FixMinify = "minify" )
Fix actions applied by POST …/readiness/fixes.
const ( // FixExcludeRisky leaves the audience's risky addresses out of the send. FixExcludeRisky = "exclude_risky" // FixVerifyAddresses opens the Verify addresses dialog on Review & send; // the dialog starts the job, so the fixes endpoint never applies it. FixVerifyAddresses = "verify_addresses" )
Fix actions of the address checks.
const ( )
Thresholds of the address checks.
const AudienceChangeLimit = 0.10
AudienceChangeLimit is how much the audience may grow or shrink after a person confirmed it before the send is held.
const FixRuleAddParam = "rule_add_param"
FixRuleAddParam adds a workspace rule's query parameter to the links missing it ("Add utm_campaign=weekly-digest-142").
const GroupAccessibility = "accessibility"
GroupAccessibility is the Accessibility group's key.
const GroupConditional = "conditional"
GroupConditional is the Conditional content group's key.
const GroupLanguages = "languages"
GroupLanguages is the Languages group: who gets which version.
const GroupRules = "rules"
GroupRules is the Workspace rules group's key.
const HeldExpiry = 3 * time.Hour
HeldExpiry is how long after its time a held send waits for a person; then it expires back to Draft (schedule and A/B test kept).
const MinRateVolume = manage.MinRateVolume
MinRateVolume is how many messages ReputeCast's own 7-day rates need before they can warn about or block a provider: the one rule Deliverability's provider card uses too (manage.TooFewToJudge).
const Shorteners = "shorteners"
Shorteners is the value of a link-domain rule that names the URL shortener domains (ShortenerDomains).
const UnknownUnchecked = "unchecked"
UnknownUnchecked is why a domain of the send's reputation is unknown when Deliverability doesn't watch it and the run can't look it up live.
Variables ¶
var DefaultMailboxRates = map[string]float64{"gmail": 0, "outlook": 5, "yahoo": 4, "icloud": 3, "other": 0}
DefaultMailboxRates are the per-mailbox-provider throttles: Outlook, Yahoo and iCloud accept slower streams more reliably; Gmail and the rest take each provider's full rate. The sending engine adapts them when deferrals rise.
var ErrRunning = errors.New("send readiness is already running for this campaign")
ErrRunning means a run of the campaign is already in progress.
var Groups = []string{GroupReputation, GroupAuthentication, GroupContent, GroupLanguages, GroupAccessibility, GroupConditional, GroupLinks, GroupCompliance, GroupAudience, GroupRouting, GroupRules}
Groups lists the check groups in checklist order.
var MailboxOrder = []string{"gmail", "outlook", "yahoo", "icloud", "other"}
MailboxOrder is the chart order of mailbox providers.
var ShortenerDomains = []string{"bit.ly", "t.co", "tinyurl.com", "ow.ly", "buff.ly", "goo.gl", "is.gd", "rebrand.ly", "cutt.ly", "shorturl.at",
"t.ly", "tiny.cc", "bl.ink", "rb.gy", "lnkd.in", "s.id", "v.gd", "soo.gd", "clck.ru", "qr.ae", "adf.ly", "bit.do", "mcaf.ee", "su.pr", "po.st",
"x.co", "db.tt", "trib.al", "dlvr.it", "fb.me", "amzn.to", "wp.me", "ift.tt", "shorte.st", "tr.im", "cli.gs", "snip.ly", "hubs.ly", "mzl.la", "j.mp"}
ShortenerDomains are the URL shorteners a "No URL shorteners" rule keeps out of links: mailbox providers distrust them, and a shortener's domain on a blocklist takes every email that uses it along.
var URIBlocklists = contentcheck.URIListNames
URIBlocklists are the URI blocklists link domains are looked up on.
Functions ¶
func AddLinkParam ¶
AddLinkParam adds param=value to every web link of src without param (merge tags, mailto: and anchors are left as they are) and says how many it changed.
func ArgAnd ¶
ArgAnd joins items as a list: "SES, Postal and Postmark", "SES, Postal và Postmark". Items are strings or Texts.
func ArgDayMonth ¶
ArgDayMonth is a day without its weekday: "12 Oct".
func ArgDayMonthTime ¶
ArgDayMonthTime is a day and a time without the weekday: "12 Oct, 09:40".
func ArgDayTime ¶
ArgDayTime is a day and a time: "Mon 12 Oct, 09:40".
func ArgLanguage ¶
ArgLanguage is a content language's name in the reader's language: "Spanish", "Tiếng Tây Ban Nha".
func ArgPercent ¶
ArgPercent is a percentage with up to two decimals: "0.6%", "0,04%".
func ArgPercent1 ¶
ArgPercent1 is a percentage with one decimal: "3.0%".
func AudienceDigest ¶
func AudienceDigest(raw json.RawMessage) string
AudienceDigest identifies who a campaign goes to as it is defined: its lists and segments, the lists and segments it excludes, whether it leaves out the unengaged, and who on the lists gets it (Earn's paid audience). The order lists were picked in doesn't count; contacts joining or leaving the lists do not change it (the recipient count does).
func Clock ¶
Clock formats a time in the workspace zone: "09:40" today, "Mon 12 Oct, 09:40" on another day.
func DismissedKeys ¶
func DismissedKeys(run ReadinessRun) []string
DismissedKeys are the keys of the run's warnings dismissed in the composer: acknowledged without a tick.
func EncodeResult ¶
func EncodeResult(res ReadinessResult) (checks, estimates json.RawMessage, err error)
EncodeResult is the stored form of a result: readiness_runs.checks (verdict, counts, groups and checks) and readiness_runs.estimates, with the messages their texts are written from.
func Fingerprint ¶
func Fingerprint(c store.ReadinessCampaignRow, routing json.RawMessage) string
Fingerprint identifies what a run checks: content, sender, audience, route override, the Broadcasts routing rules and the schedule. Any change to them makes the latest run stale.
func GroupTitle ¶
GroupTitle is the heading of a check group ("Audience quality").
func HTMLOnly ¶
HTMLOnly reports whether a campaign is written in HTML only (the HTML editor, an import): it has no MJML to edit or compile.
func InsertFooter ¶
InsertFooter adds the footer block at the end of the MJML body, or puts the composer's footer block back as new when it lost its address or links.
func InsertFooterIn ¶
InsertFooterIn is InsertFooter with the block's words in a language.
func LookupFailed ¶
func LookupFailed(a dnscheck.DomainAuth) bool
LookupFailed reports whether any lookup of a domain's authentication check failed (DNS didn't answer), as opposed to finding a record missing or wrong.
func MailboxName ¶
MailboxName is the display name of a mailbox provider key.
func MarkDismissed ¶
func MarkDismissed(run *ReadinessRun, d map[string]campaigns.ComposerDismissal)
MarkDismissed sets Dismissal on the run's warnings whose every composer warning was dismissed (d is keyed by issue key), and clears it on the others. The latest dismissal speaks for the warning.
func Minutes ¶
Minutes rounds a duration in seconds up to whole minutes (at least 1 when anything is sent).
func Pct ¶
Pct formats a percentage with up to two decimals, trailing zeros trimmed: 0.6 → "0.6%", 0.04 → "0.04%", 5 → "5%".
func ProviderDataOnly ¶
func ProviderDataOnly(checks []ReadinessCheck) bool
ProviderDataOnly reports whether every check that couldn't run is sender reputation data (HostRepute's blocklists, a domain looked up live, the providers' rates): continuing without them leaves the providers' own data. Content, accessibility, link or authentication checks that couldn't run are skipped instead (R1.U8). Review & send words its button the same way.
func Relookup ¶
func Relookup(ctx context.Context, r dnscheck.Resolver, domain string, stored dnscheck.DomainAuth) dnscheck.DomainAuth
Relookup checks a sending domain again, with the records its providers require (those of the stored check), within 20 seconds.
func ReplaceLink ¶
ReplaceLink points every link to from at to.
func RoutingKey ¶
RoutingKey is the Broadcasts routing as it stands, part of a run's fingerprint.
func RunningText ¶
RunningText is what a group shows while its checks run, before facts exist.
func ShareStatusIn ¶
ShareStatusIn is a copied status label of a route's provider in a reader's language: from its kept message, or from its status and warm-up day when they say what the copied English says. Any other label stays as it was copied.
func SplitLabelIn ¶
SplitLabelIn is a copied split label of the Broadcasts route ("Broadcasts 90 / 10", as Route writes it for an approval's snapshot) in a reader's language. Any other label stays as it was copied.
func ThresholdsLine ¶
func ThresholdsLine(t ReadinessThresholds) string
ThresholdsLine is "bounce 2.0% · complaint 0.10%".
func WithLanguages ¶
WithLanguages adds a campaign's language versions (languages.CampaignDigest) to its fingerprint; a campaign without versions keeps its fingerprint.
func WithoutTexts ¶
func WithoutTexts(raw json.RawMessage) json.RawMessage
WithoutTexts drops the kept messages ("i18n" members) from stored JSON, for readers that get it as it is stored (MCP agents read English). Everything else keeps its order and values.
Types ¶
type AccessibilityChecker ¶
type AccessibilityChecker interface {
ReadinessFacts(ctx context.Context, ws *store.Workspace, c accessibility.CampaignContent) accessibility.ReadinessFacts
FixMJML(ctx context.Context, ws *store.Workspace, src, action string, params map[string]string) (string, accessibility.FixChange, error)
RecordFix(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID uuid.UUID, campaign, contentHash string, languages []string, changes []accessibility.FixChange) error
}
AccessibilityChecker runs the accessibility checks for a run and applies the group's one-click fixes.
type AfterChange ¶
AfterChange is told when a fix or a send setting changed the campaign (the approvals domain re-checks open approvals).
type AudienceDef ¶
type AudienceDef struct {
Lists []string `json:"lists,omitempty"`
Segments []string `json:"segments,omitempty"`
ExcludeLists []string `json:"exclude_lists,omitempty"`
ExcludeSegments []string `json:"exclude_segments,omitempty"`
ExcludeTiers []string `json:"exclude_tiers,omitempty"`
// IncludeSunset is the campaign overriding the sunset policy: contacts
// whose Broadcasts the policy stopped receive this one anyway.
IncludeSunset bool `json:"include_sunset,omitempty"`
// IncludeUnengaged includes (true) or leaves out (false) the unengaged
// contacts (the sunset tier) for this campaign. Unset, a send leaves
// them out unless it overrides the sunset policy (SR-11, C2: "Include
// them").
IncludeUnengaged *bool `json:"include_unengaged,omitempty"`
// Paid is who on the lists gets a paid-only campaign (Earn): paid
// members only, at a tier and above, or free subscribers only.
Paid paidaccess.Audience `json:"-"`
// RetryOf is the issue a retry campaign sends again, only to its
// addresses blocked for the sender's reputation (review AN-7); a fix
// that edits the audience keeps it.
RetryOf string `json:"retry_of,omitempty"`
}
AudienceDef is campaigns.audience as stored by the composer, plus the tiers Send Readiness can exclude.
func ParseAudience ¶
func ParseAudience(raw json.RawMessage) AudienceDef
ParseAudience reads a stored audience definition.
func (AudienceDef) Empty ¶
func (a AudienceDef) Empty() bool
Empty reports whether the definition selects nobody.
func (AudienceDef) ExcludesSunset ¶
func (a AudienceDef) ExcludesSunset() bool
ExcludesSunset reports whether the unengaged contacts (the sunset tier) are left out of the send by default (LeavesOutUnengaged).
func (AudienceDef) LeavesOutUnengaged ¶
func (a AudienceDef) LeavesOutUnengaged(byDefault bool) bool
LeavesOutUnengaged reports whether the unengaged contacts (the sunset tier) are left out of the send: when the tier is excluded, when the campaign leaves them out, and otherwise as byDefault says unless the campaign overrides the sunset policy (SR-11). The sending engine leaves out the same contacts.
type AudienceFacts ¶
type AudienceFacts struct {
// BaseLabel names the audience ("Weekly Digest list", "All subscribers").
BaseLabel string
// GroupLabel is the caption of the audience-quality group ("Weekly Digest").
GroupLabel string
// BaseKind says what BaseLabel names and BaseName the list or segment,
// so the labels read in each reader's language; empty shows the labels
// as they are.
BaseKind string
BaseName string
Lists []string
// Base counts the subscribed contacts of the lists and segments (minus
// excluded lists and segments).
Base int64
Suppressed int64
Role int64
Duplicates int64
// Stopped counts contacts the sunset policy stopped Broadcasts to.
Stopped int64
// SunsetOverride is true when the campaign overrides the sunset policy;
// StoppedIncluded counts the stopped contacts it sends to anyway.
SunsetOverride bool
StoppedIncluded int64
// SunsetExcluded counts the sunset-tier contacts removed because the
// campaign excludes that tier; UnengagedExcluded says it does.
SunsetExcluded int64
UnengagedExcluded bool
Final int64
// Unengaged counts final recipients with no open or click in
// UnengagedDays days (the sunset tier).
Unengaged int64
UnengagedDays int
// RecentlyBounced counts final recipients who bounced in the last 30
// days without being suppressed (soft bounces).
RecentlyBounced int64
// NoFirstName counts final recipients without a first name (what a
// first-name tag's fallback is for).
NoFirstName int64
// Mailboxes counts final recipients per mailbox provider.
Mailboxes map[string]int64
// Languages counts final recipients per contact language code
// (lowercase, "" for none), for content languages.
Languages map[string]int64
// Empty is true when the campaign has no audience yet.
Empty bool
// SegmentsSkipped is true when segments couldn't be counted.
SegmentsSkipped bool
// SuppressedEmails are the suppressed contacts' addresses, for the
// address checks' count of invalid ones (verification.go).
SuppressedEmails []string `json:"-"`
// Paid describes a paid-only campaign's recipients (paid.go); nil for
// everyone on the lists.
Paid *PaidAudienceFacts `json:"-"`
// Retry describes a retry's recipients (retry.go); nil when the
// campaign isn't a retry.
Retry *RetryAudienceFacts `json:"-"`
}
AudienceFacts are the audience counts after exclusions.
type AuthFacts ¶
type AuthFacts struct {
Domain string
// Checked is false until deliverability has checked the domain.
Checked bool
CheckedAt *time.Time
SPFRecord string
SPF []ProviderAuthFacts
DKIM []ProviderAuthFacts
MailFrom []ProviderAuthFacts
// DMARC: status (pass, missing, invalid), policy, the record and the
// share of aligned mail over the last 7 days (nil without reports).
DMARCStatus string
DMARCPolicy string
DMARCRecord string
DMARCAligned *float64
// DMARCDomain is where the record was found: the domain itself or its
// organizational domain (the record is at _dmarc.DMARCDomain).
DMARCDomain string
// BIMIStatus is pass, missing, invalid or error.
BIMIStatus string
BIMILogo string
// DMARCError and BIMIError say why a lookup failed (Trouble* kinds):
// the record's state is unknown, not wrong. BIMIProblem is what's wrong
// with an invalid BIMI record ("l= must be an https URL…").
DMARCError string
BIMIError string
// SPFError says why the domain's own SPF record couldn't be read.
SPFError string
BIMIProblem string
}
AuthFacts are the authentication results of the sending domain.
func AuthFactsOf ¶
func AuthFactsOf(domain string, auth dnscheck.DomainAuth, orgDMARC *dnscheck.DMARC, shares []ShareFacts) AuthFacts
AuthFactsOf turns a domain's authentication check into the facts of the providers carrying the send: their SPF, DKIM and MAIL FROM records. A record whose lookup failed is unknown, unless another record of the same kind is definitely wrong.
type CampaignFacts ¶
type CampaignFacts struct {
ID string
Name string
Subject string
Preheader string
Version int
// CompiledAt is when the content was last compiled (saved).
CompiledAt *time.Time
SenderName string
// SenderEmail is the From address; SenderDomain its domain.
SenderEmail string
SenderDomain string
// ReplyTo is the campaign's reply-to address, else its sender's: the
// one-click unsubscribe header's mailto, as the send writes it.
ReplyTo string
// StartAt is when the send would start (the schedule, or now).
StartAt time.Time
// ScheduleMode is now, at or best_time.
ScheduleMode string
// HTMLOnly is true for a campaign written in HTML (no MJML): fixes
// that edit MJML aren't offered.
HTMLOnly bool
// ABKind is the kind of the campaign's A/B test (subject, content or
// send_time), empty without one; the variants' checks are
// ContentFacts.Variants.
ABKind string
}
CampaignFacts describes the campaign being checked.
type ComplianceFacts ¶
type ComplianceFacts struct {
// UnsubscribeURL is the one-click unsubscribe link with a {token} placeholder.
UnsubscribeURL string
// Mailto is the List-Unsubscribe header's mailto address (the reply-to
// address, else the From address), as the send writes it.
Mailto string
HTTPS bool
// ComplaintRate is the route's 7-day complaint rate in percent.
ComplaintRate *float64
// Gmail is Gmail Postmaster Tools' latest day for the sending domain
// (or its parent), nil when there is none. PostmasterConnected says
// Postmaster data comes in for the workspace at all.
Gmail *PostmasterFacts
PostmasterConnected bool
}
ComplianceFacts are what the bulk-sender rules need.
type ComposerReadiness ¶
type ComposerReadiness struct {
// RanAt is when the latest run ran; nil when the checks never ran.
RanAt *time.Time `json:"ranAt,omitempty"`
// CheckedAt is when HostRepute's hourly blocklist check ran.
CheckedAt *time.Time `json:"checkedAt,omitempty"`
// Rules is nil when no workspace rule applies to the campaign.
Rules *ComposerReadinessGroup `json:"rules,omitempty"`
Reputation *ComposerReadinessGroup `json:"reputation,omitempty"`
}
ComposerReadiness is what the composer's checks show from Send Readiness (Composer board: the Workspace rules and Sender reputation rows), from the campaign's latest run: the checks aren't run again for it.
func ComposerFindings ¶
func ComposerFindings(run *ReadinessRun) ComposerReadiness
ComposerFindings is a run's workspace rules and sender reputation for the composer's checks.
type ComposerReadinessGroup ¶
type ComposerReadinessGroup struct {
Warnings int `json:"warnings"`
Blocks int `json:"blocks"`
Checks []ReadinessCheck `json:"checks"`
}
ComposerReadinessGroup is how a group stands: its warnings and blocks, with their checks in the reader's language.
type ConditionalChecker ¶
type ConditionalChecker interface {
ConditionalFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID) ConditionalFacts
PollFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src string) PollFacts
}
ConditionalChecker gives the facts of the Conditional content group and of the poll checks; nil leaves them out.
type ConditionalFacts ¶
type ConditionalFacts struct {
Ran bool
// Checked is false when the versions couldn't be counted; Problem says why.
Checked bool
Problem string
Report visibility.VisibilityReport
}
ConditionalFacts are an email's conditional blocks and the versions its audience gets.
type ConfirmFacts ¶
type ConfirmFacts struct {
// Usual is the median audience of the last sends to the campaign's
// lists (Sends of them, at most 5); 0 without any. Multiple is the
// workspace's threshold (Settings › Sending rules).
Usual int64
Sends int
Multiple float64
// FirstList names a list never sent to, FirstDomain the sending
// domain when nothing went out from it yet, FirstProviders the route's
// providers that never carried a send.
FirstList string
FirstDomain string
FirstProviders []string
}
ConfirmFacts are what makes a send unusual.
type Confirmation ¶
type Confirmation struct {
RunID string
ConfirmedBy *uuid.UUID
ConfirmedAt time.Time
ScheduledAt *time.Time
Recipients int64
// Acknowledged are the warnings confirmed; Unknown the checks that
// were unknown when they chose to continue without them.
Acknowledged []string
Unknown []string
Digests
// Canary is the canary choice confirmed with the send (C1): auto, on
// or off; the sending engine reads it as the send starts.
Canary string
}
Confirmation is what a person confirmed when they scheduled a send.
type ContentFacts ¶
type ContentFacts struct {
Report contentcheck.ContentCheckReport
// what it shows).
FooterText string
// Checked is false when the content check couldn't run.
Checked bool
FooterRemovedAt *time.Time
// Address is the postal address of the workspace branding.
Address string
// InlineCSSBytes is the size of the inline style attributes.
InlineCSSBytes int
// URIBlocklists are the lists link domains were checked on.
URIBlocklists []string
// OwnDomain is the registrable domain of the sending domain ("acme.io").
OwnDomain string
// Versions are the content checks of the language versions that are
// sent, besides the source's (Report).
Versions []VersionReport
// Variants are the content checks of an A/B test's variants B and C
// (the campaign itself is variant A).
Variants []VariantReport
// TrackedBytes is the HTML's size as sent, with the links rewritten for
// tracking and the open pixel added (0 when nothing is tracked or the
// email couldn't be prepared).
TrackedBytes int
// TrackOpens and TrackClicks say what the campaign tracks;
// TrackingHost is the domain of the open pixel and the tracked links,
// TrackingHTTPS whether they use HTTPS, and TrackingDNS whether that
// domain resolves: ok, missing, or a Trouble* kind when DNS didn't
// answer ("" when it wasn't looked up).
TrackOpens, TrackClicks bool
TrackingHost string
TrackingHTTPS bool
TrackingDNS string
// LibraryHost is where the media library's images load from (the
// public URL), LibraryHTTPS whether over HTTPS.
LibraryHost string
LibraryHTTPS bool
// Fields are the personalization tags of the email (every version and
// variant), each field once.
Fields []FieldUse
}
ContentFacts are the composer's content and link checks.
type Deliverability ¶
type Deliverability interface {
Overview(ctx context.Context, ws *store.Workspace) (deliverability.DeliverabilityOverview, error)
Reputation(ctx context.Context, ws *store.Workspace) (deliverability.DeliverabilityReputation, error)
}
Deliverability is what a run reads from the deliverability domain: blocklist results, authentication and provider account health.
type Digests ¶
type Digests struct {
Content string `json:"content"`
Audience string `json:"audience"`
Sender string `json:"sender"`
Route string `json:"route"`
}
Digests identify the campaign a person confirmed: its content (with its language versions), its audience as defined (AudienceDigest), its sender and its route (the campaign's override and the Broadcasts rules).
type DomainAssetFacts ¶
type DomainAssetFacts struct {
Domain string
Role string
// Providers are the providers whose return path the domain is.
Providers []string
// Live is true when Send Readiness looked the domain up itself on the
// URI blocklists (Deliverability doesn't watch it): Lists are the lists
// it is on, Unknown why it isn't known (a contentcheck.Trouble* kind, or
// UnknownUnchecked when nothing could look it up).
Live bool
Lists []string
Unknown string
}
DomainAssetFacts is one domain of a send's reputation.
type DownFacts ¶
DownFacts is why a provider can't take mail: since when, the host or provider it's about, and either rejected credentials (Auth) or refused connections with the error code (Code).
type EndedUpgradeOffer ¶
type EndedUpgradeOffer struct {
Code string
Name string
EndedOn *time.Time
// Path is the block's element path from mj-body.
Path []int
}
EndedUpgradeOffer is an offer an email's Upgrade block carries after it ended.
type Estimator ¶
type Estimator interface {
Estimate(ctx context.Context, campaignID uuid.UUID, o engine.EstimateOptions) (engine.Estimate, error)
}
Estimator estimates a send with the sending engine's own rules (engine.Engine).
type Facts ¶
type Facts struct {
Now time.Time
// Location is the workspace time zone (clock times in the evidence).
Location *time.Location
// Workspace is the slug, for links to other screens.
Workspace string
Campaign CampaignFacts
Audience AudienceFacts
Route RouteFacts
Reputation ReputationFacts
Auth AuthFacts
Content ContentFacts
Compliance ComplianceFacts
// Languages are the email's language versions (content languages).
Languages LanguagesFacts
// Accessibility is the accessibility checks of every language version.
Accessibility accessibility.ReadinessFacts
// Conditional is the email's conditional blocks and versions, Polls its
// polls and surveys (design expansion, X11).
Conditional ConditionalFacts
Polls PollFacts
// Verification is the audience's address-check results (verification.go).
Verification VerificationFacts
// Web is the campaign's post on the website (design expansion, X18).
Web WebFacts
// Sponsor is the email's Sponsor block, UpgradeOffers the offers its
// Upgrade blocks still carry after they ended (Earn, design expansion X17).
Sponsor SponsorFacts
UpgradeOffers []EndedUpgradeOffer
// MailboxRates are the per-mailbox-provider throttles (messages per
// second, 0 = full rate).
MailboxRates map[string]float64
// Grow are the Referral and Recommendations blocks' rows (grow.go).
Grow []GrowRow
// Rules are the workspace's sending rules for the send's stream
// (rules.go, SR-10).
Rules []RuleFacts
// Confirm is what makes the send unusual enough for a typed
// confirmation (confirm.go, SR-13).
Confirm ConfirmFacts
}
Facts is everything a run looked at. Gather collects them from the other domains; the demo and tests build them by hand. Assemble turns them into the checklist and the estimates.
type FallbackFacts ¶
type FallbackFacts struct {
ProviderID string
Name string
// Failed is the first vetting check that failed, empty when the
// fallback can take the mail; Text says it in each reader's language.
Failed string
Text Text
}
FallbackFacts is the provider the route fails over to and what state.Vet found about it taking the whole send (C11).
type GrowChecker ¶
type GrowChecker interface {
ReadinessRows(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, html string, byList map[uuid.UUID]int64, recipients int64) []GrowRow
}
GrowChecker reads what Grow's blocks do in a campaign: the campaign's HTML, its recipients per list and how many there are.
type GrowRow ¶
type GrowRow struct {
Key string
Status string // pass or warn
Title Text
Detail Text
Label Text
Short Text
Ack Text
// Links open the campaign or Grow ("Remove the block", "Referral
// settings", "Open recommendations"), as workspace paths.
Links []GrowLink
}
GrowRow is one of Grow's Content rows. Its texts are kept messages of Grow's catalogs (Kept), so the row reads in each reader's language.
type JobInserter ¶
type JobInserter interface {
InsertTx(ctx context.Context, tx pgx.Tx, args river.JobArgs, opts *river.InsertOpts) (*rivertype.JobInsertResult, error)
}
JobInserter queues jobs in a transaction (River's client).
type LanguagesFacts ¶
type LanguagesFacts = languages.ReadinessFacts
LanguagesFacts are the email's language versions and who gets which.
type ListingFacts ¶
type ListingFacts struct {
Asset string
Type string // domain, ip
Source string
Impact string // high, medium, low
Detail string
DelistURL string
Since *time.Time
// Answer and TXT are the list's DNS answers to the lookup when they
// are known (the technical details' raw DNS, SR-13).
Answer, TXT string
}
ListingFacts is one asset on one blocklist.
type MailboxClassifier ¶
type MailboxClassifier interface {
ClassifyPending(ctx context.Context, workspaceID uuid.UUID, budget time.Duration) (int64, error)
}
MailboxClassifier is the part of mailbox.Classifier Send Readiness uses.
type PaidAudienceFacts ¶
type PaidAudienceFacts struct {
// Who is paid (paid members only) or free (free subscribers only).
Who string
// Tier is the lowest tier's short name ("Insider"), empty for any paid
// tier; TierTop says it is the highest tier ("Founding member" rather
// than "Founding member and above").
Tier string
TierTop bool
// What the paid members' access is.
Trialing int64
Complimentary int64
Gift int64
PastDue int64
}
PaidAudienceFacts are a paid-only campaign's final recipients by paid status.
type PollFacts ¶
type PollFacts = polls.ReadinessFacts
PollFacts are an email's polls, the surveys it links to and where their links go.
type PostmasterFacts ¶
type PostmasterFacts struct {
Domain string
// Day is the latest day Google reported; SpamRate is that day's
// user-reported spam rate in percent (nil when Google had too little
// volume to report one).
Day time.Time
SpamRate *float64
// SpamDay is the day of SpamRate when it isn't Day (the latest day
// with a rate).
SpamDay *time.Time
// SPF, DKIM, DMARC and TLS are Day's pass rates in percent, nil when
// Google didn't report one.
SPF, DKIM, DMARC, TLS *float64
}
PostmasterFacts is what Gmail Postmaster Tools reported for a domain.
type ProviderAuthFacts ¶
type ProviderAuthFacts struct {
Short string
// OK is true when the record is verified (and aligned, for MAIL FROM).
OK bool
// Detail: "3 Easy DKIM CNAMEs verified", "selector postal-2026 verified",
// the MAIL FROM domain, or what's wrong. DetailKind says which, with
// its parts (CNAMEs, Selector, Value and Name), so it reads in each
// reader's language; empty shows Detail as it is.
Detail string
DetailKind string
CNAMEs int
Selector string
Value string
Name string
KeyBits int
Domain string
// Unknown is true when DNS didn't answer for the record (even after the
// run looked it up again); Trouble says how (Trouble* kinds).
Unknown bool
Trouble string
}
ProviderAuthFacts is one provider's record of one kind.
type ReadinessABTimeline ¶
type ReadinessABTimeline struct {
Kind string `json:"kind" enum:"subject,content,send_time"`
TestPercent int `json:"testPercent"`
Variants int `json:"variants"`
Sample int64 `json:"sample"`
// PerVariant is the sample of each variant.
PerVariant int64 `json:"perVariant"`
// SampleEnd is when the sample's last message goes out; DecideAt when
// the winner is picked (nil when a person picks it); Hours the wait.
SampleEnd time.Time `json:"sampleEnd"`
DecideAt *time.Time `json:"decideAt,omitempty"`
Hours int `json:"hours"`
}
ReadinessABTimeline is an A/B test's sample, wait and rest.
type ReadinessAudience ¶
type ReadinessAudience struct {
Rows []ReadinessAudienceRow `json:"rows"`
Final int64 `json:"final"`
// Lists names the lists and segments of the audience.
Lists []string `json:"lists"`
// Suppressed, Role and Duplicates repeat the excluded counts for the
// confirmation ("331 suppressed · 27 role · 26 duplicates").
Suppressed int64 `json:"suppressed"`
Role int64 `json:"role"`
Duplicates int64 `json:"duplicates"`
Unengaged int64 `json:"unengaged"`
// UnengagedExcluded is true when the unengaged (the sunset tier) are
// left out, as they are by default, and ExcludedUnengaged counts them.
UnengagedExcluded bool `json:"unengagedExcluded"`
ExcludedUnengaged int64 `json:"excludedUnengaged"`
}
ReadinessAudience is the final count after exclusions.
type ReadinessAudienceRow ¶
type ReadinessAudienceRow struct {
Label string `json:"label"`
Count int64 `json:"count"`
// Kind: base (the lists or segments), minus (excluded), plus (added back).
Kind string `json:"kind" enum:"base,minus,plus"`
// Action is the fix the line offers: include_unengaged ("Include
// them") on the unengaged contacts the send leaves out.
Action string `json:"action,omitempty" enum:"include_unengaged"`
}
ReadinessAudienceRow is one line of the audience card.
type ReadinessCampaignPath ¶
type ReadinessCampaignPath struct {
api.WorkspaceInput
CampaignID string `path:"campaignId" format:"uuid"`
}
ReadinessCampaignPath is the {workspace}/{campaignId} of readiness operations.
type ReadinessCheck ¶
type ReadinessCheck struct {
// Key identifies the check: "audience.unengaged", "reputation.provider.ses".
Key string `json:"key"`
Group string `` /* 129-byte string literal not displayed */
Status string `json:"status" enum:"pass,warn,block,unknown"`
// Title states the finding; FlatTitle is the same finding prefixed with
// its group, for lists ordered by severity ("Links: go.acme-promo.link…").
Title string `json:"title"`
FlatTitle string `json:"flatTitle"`
// Detail is the evidence. Mono is true when it is a record or a header.
Detail string `json:"detail,omitempty"`
Mono bool `json:"mono,omitempty"`
// Label names the check in compact tables ("URL shortener"); Evidence is
// a one-sentence version of title and detail for them.
Label string `json:"label,omitempty"`
Evidence string `json:"evidence,omitempty"`
// Short is the passing finding in a few words, used in group summaries.
Short string `json:"short,omitempty"`
// Ack is the sentence a person confirms before sending with this warning
// ("I understand 412 unengaged contacts are included.").
Ack string `json:"ack,omitempty"`
// AckKey is the same for warnings confirmed with the same sentence,
// whatever language it is read in: they are confirmed together.
AckKey string `json:"ackKey,omitempty"`
// Note is a short right-aligned note ("timed out").
Note string `json:"note,omitempty"`
Fixes []ReadinessFix `json:"fixes"`
// Rows are a small table of the finding ("Recipients per language":
// English 26,890 gets English · …).
Rows []ReadinessCheckRow `json:"rows,omitempty"`
// Technical are the check's technical details (a workspace rule, what
// it checks and what broke it; a blocklist and its scope), and Raw the
// records, answers or addresses behind them, shown as they are.
Technical []ReadinessTechRow `json:"technical,omitempty"`
Raw []string `json:"raw,omitempty"`
// IssueKeys name the composer's warnings this warning is made of (the
// content checks' issue keys). Dismissal is set when someone dismissed
// every one of them in the composer, with a reason (CO-14): the warning
// stays listed and counts as acknowledged.
IssueKeys []string `json:"issueKeys,omitempty"`
Dismissal *ReadinessDismissal `json:"dismissal,omitempty"`
// contains filtered or unexported fields
}
ReadinessCheck is one row of the checklist.
func InChecks ¶
func InChecks(checks []ReadinessCheck, l i18n.Lang) []ReadinessCheck
InChecks is checks as a reader reads them.
func (ReadinessCheck) In ¶
func (c ReadinessCheck) In(l i18n.Lang) ReadinessCheck
In is the check as a reader reads it, in their language and region, without its kept messages.
func (ReadinessCheck) MarshalJSON ¶
func (c ReadinessCheck) MarshalJSON() ([]byte, error)
MarshalJSON adds the kept messages ("i18n") to the check.
func (*ReadinessCheck) UnmarshalJSON ¶
func (c *ReadinessCheck) UnmarshalJSON(b []byte) error
UnmarshalJSON reads a check and its kept messages.
type ReadinessCheckRow ¶
type ReadinessCheckRow struct {
Label string `json:"label"`
Count int64 `json:"count"`
Detail string `json:"detail"`
// Language is the readers' language and Gets the version they get
// (Recipients per language: Audience › By version and the
// confirmation step read them).
Language string `json:"language,omitempty"`
Gets string `json:"gets,omitempty"`
GetsName string `json:"getsName,omitempty"`
}
ReadinessCheckRow is one line of a check's table.
type ReadinessConfirm ¶
type ReadinessConfirm struct {
Typed bool `json:"typed"`
Reasons []string `json:"reasons"`
// Usual is the usual audience of the campaign's lists (0 without one).
Usual int64 `json:"usual"`
}
ReadinessConfirm says whether the sender types the recipient count, and why ("31,192 is 2.1× your usual 15,000 for this list.").
type ReadinessCounts ¶
type ReadinessCounts struct {
Passed int `json:"passed"`
Warnings int `json:"warnings"`
Blocks int `json:"blocks"`
Unknown int `json:"unknown"`
Total int `json:"total"`
}
ReadinessCounts adds up the checks.
type ReadinessDismissal ¶
type ReadinessDismissal struct {
ID string `json:"id"`
By string `json:"by"`
Reason string `json:"reason" enum:"decorative,size,subject,wrong,other"`
ReasonText string `json:"reasonText"`
Note string `json:"note,omitempty"`
At time.Time `json:"at"`
Count int `json:"count"`
}
ReadinessDismissal is a warning dismissed in the composer, as the composer's Checks show it: who, why (in the reader's language) and their note for reviewers. ID undoes it (DELETE …/dismissals/{id}); Count is how many of the composer's warnings it covers (all the warning is made of).
type ReadinessEstimates ¶
type ReadinessEstimates struct {
Audience ReadinessAudience `json:"audience"`
Route ReadinessRoute `json:"route"`
Throttling []ReadinessThrottle `json:"throttling"`
// Confirm says whether the sender types the recipient count, and why
// (only unusual sends ask, SR-13).
Confirm *ReadinessConfirm `json:"confirm,omitempty"`
// HourlyAt is when HostRepute's hourly check found the sender
// blocklist results the run used (nil when they were looked up live).
HourlyAt *time.Time `json:"hourlyAt,omitempty"`
// contains filtered or unexported fields
}
ReadinessEstimates are the numbers around the send.
func (ReadinessEstimates) In ¶
func (e ReadinessEstimates) In(l i18n.Lang) ReadinessEstimates
In is the estimates as a reader reads them.
func (ReadinessEstimates) MarshalJSON ¶
func (e ReadinessEstimates) MarshalJSON() ([]byte, error)
MarshalJSON adds the labels' kept messages ("i18n") to the estimates.
func (ReadinessEstimates) ShareStatus ¶
func (e ReadinessEstimates) ShareStatus(i int) Text
ShareStatus is the kept message of the status label of the route's i-th provider, for a reader that copies the label (an approval's snapshot); nothing when the run kept none.
func (*ReadinessEstimates) UnmarshalJSON ¶
func (e *ReadinessEstimates) UnmarshalJSON(b []byte) error
UnmarshalJSON reads the estimates and their labels' kept messages.
type ReadinessFix ¶
type ReadinessFix struct {
Kind string `json:"kind" enum:"apply,link"`
Action string `` /* 432-byte string literal not displayed */
Label string `json:"label"`
Tone string `json:"tone,omitempty" enum:"primary,danger"`
Href string `json:"href,omitempty"`
Params map[string]string `json:"params,omitempty"`
// Note says in a few words what applying the fix changes ("+3 min ·
// +$0.31", "Changes 2 links · preview first", "No change to this
// send"); Effects are what the fix review lists before it is applied
// (SR-13): the route, duration and cost it changes, the links it
// rewrites (Before and Value).
Note string `json:"note,omitempty"`
Effects []ReadinessTechRow `json:"effects,omitempty"`
}
ReadinessFix is one fix offered with a check: an action ReputeCast applies in one click (Kind "apply", Action and Params) or a link to the screen where it's fixed (Kind "link", Href is an app path).
type ReadinessFixBatch ¶
type ReadinessFixBatch struct {
ID string `json:"id"`
AppliedAt time.Time `json:"appliedAt"`
AppliedBy string `json:"appliedBy"`
// Applied are the fixes as the person who applied them read them; empty
// for readers of another language, who read Count.
Applied []string `json:"applied"`
Count int `json:"count"`
// Version is the campaign version the batch's content fixes saved; 0
// when they changed no content.
Version int `json:"version,omitempty"`
// Undoable is false when the batch changed what Undo can't put back (a
// language version or a language's state; Version history can).
Undoable bool `json:"undoable"`
// Route is true when the batch changed the route: undoing it needs the
// right to send, as applying it did.
Route bool `json:"route,omitempty"`
}
ReadinessFixBatch is one "Apply fixes": the fixes applied together, by whom and when, and whether Undo can put the campaign back as it was.
type ReadinessFixOutcome ¶
type ReadinessFixOutcome struct {
ReadinessFixResult
Running *ReadinessProgress `json:"running,omitempty"`
}
ReadinessFixOutcome is the result of applying fixes and the run they started (in the background: poll …/readiness/progress).
type ReadinessFixRequest ¶
type ReadinessFixRequest struct {
Action string `` /* 440-byte string literal not displayed */
Params map[string]string `json:"params,omitempty"`
}
ReadinessFixRequest is one fix to apply.
type ReadinessFixResult ¶
type ReadinessFixResult struct {
// Applied are the fix labels in the product voice ("Excluded 412 unengaged contacts").
Applied []string `json:"applied"`
// Version is the campaign version after content fixes.
Version int `json:"version"`
// Batch is the fixes as Undo knows them (nil when nothing changed).
Batch *ReadinessFixBatch `json:"batch,omitempty"`
}
ReadinessFixResult says what changed.
type ReadinessFixesInput ¶
type ReadinessFixesInput struct {
Fixes []ReadinessFixRequest `json:"fixes" minItems:"1" maxItems:"10"`
}
ReadinessFixesInput applies one or more fixes ("Apply all 3 fixes").
type ReadinessGroup ¶
type ReadinessGroup struct {
Key string `` /* 127-byte string literal not displayed */
Title string `json:"title"`
Caption string `json:"caption"`
Status string `json:"status" enum:"pass,warn,block,unknown"`
Passed int `json:"passed"`
Total int `json:"total"`
// Summary is "SPF, DKIM, DMARC p=quarantine and custom MAIL FROM verified for SES".
Summary string `json:"summary"`
// Running describes the group while it runs ("checking 203.0.113.25 and
// news.acme.io on 84 sources").
Running string `json:"running"`
// Note is a sentence the verdict adds when the group blocks the send
// ("Your workspace blocks sends with serious accessibility issues…").
Note string `json:"note,omitempty"`
// contains filtered or unexported fields
}
ReadinessGroup is a group heading with its caption and a summary of what passed (the collapsed "Passed" list and the running state show it).
func (ReadinessGroup) In ¶
func (g ReadinessGroup) In(l i18n.Lang) ReadinessGroup
In is the group as a reader reads it.
func (ReadinessGroup) MarshalJSON ¶
func (g ReadinessGroup) MarshalJSON() ([]byte, error)
MarshalJSON adds the kept messages ("i18n") to the group.
func (*ReadinessGroup) UnmarshalJSON ¶
func (g *ReadinessGroup) UnmarshalJSON(b []byte) error
UnmarshalJSON reads a group and its kept messages.
type ReadinessHeldMove ¶
type ReadinessHeldMove struct {
From string `json:"from"`
To string `json:"to"`
ToID string `json:"toId"`
AddCost float64 `json:"addCost"`
AddMinutes int `json:"addMinutes"`
}
ReadinessHeldMove is what moving a held share to an available provider costs.
type ReadinessPoll ¶
type ReadinessPoll struct {
Running *ReadinessProgress `json:"running,omitempty"`
Latest *ReadinessRunRef `json:"latest,omitempty"`
Failed *ReadinessRunFailure `json:"failed,omitempty"`
}
ReadinessPoll is what the review screen polls while checks run: the run waiting or in progress, the latest stored run and a run that failed.
type ReadinessProgress ¶
type ReadinessProgress struct {
RunID string `json:"runId"`
Trigger string `json:"trigger"`
StartedAt time.Time `json:"startedAt"`
StartedBy string `json:"startedBy,omitempty"`
// StartedByType is set when StartedBy names an API key or an agent.
StartedByType string `json:"startedByType,omitempty" enum:"api_key,mcp_agent"`
// Queued is true until a worker takes the run up.
Queued bool `json:"queued"`
Done int `json:"done"`
Total int `json:"total"`
Groups []ReadinessProgressGroup `json:"groups"`
}
ReadinessProgress is a run waiting for a worker or in progress.
func ProgressForReader ¶
func ProgressForReader(ctx context.Context, p *ReadinessProgress) *ReadinessProgress
ProgressForReader is a run in progress in the request's language.
func (ReadinessProgress) In ¶
func (p ReadinessProgress) In(l i18n.Lang) ReadinessProgress
In is the run in progress as a reader reads it.
type ReadinessProgressGroup ¶
type ReadinessProgressGroup struct {
Key string `` /* 127-byte string literal not displayed */
Title string `json:"title"`
Status string `json:"status" enum:"queued,running,pass,warn,block,unknown"`
Text string `json:"text"`
// Done of Total are the group's checks that finished.
Done int `json:"done"`
Total int `json:"total"`
Checked int `json:"checked"`
// Count of Of Unit is how far the group's long step got: "9 of 14
// links", "5 of 8 domains", "24,310 of 31,988 contacts".
Unit string `json:"unit,omitempty" enum:"links,domains,contacts"`
Count int64 `json:"count"`
Of int64 `json:"of"`
// contains filtered or unexported fields
}
ReadinessProgressGroup is one group of a run in progress.
func (ReadinessProgressGroup) In ¶
func (g ReadinessProgressGroup) In(l i18n.Lang) ReadinessProgressGroup
In is the group in progress as a reader reads it.
func (ReadinessProgressGroup) MarshalJSON ¶
func (g ReadinessProgressGroup) MarshalJSON() ([]byte, error)
MarshalJSON adds the kept messages ("i18n") to the group in progress.
func (*ReadinessProgressGroup) UnmarshalJSON ¶
func (g *ReadinessProgressGroup) UnmarshalJSON(b []byte) error
UnmarshalJSON reads a group in progress and its kept messages.
type ReadinessResult ¶
type ReadinessResult struct {
Verdict string `json:"verdict" enum:"ready,warnings,blocked"`
Counts ReadinessCounts `json:"counts"`
Groups []ReadinessGroup `json:"groups"`
Checks []ReadinessCheck `json:"checks"`
// Incomplete is true when some checks couldn't run (Unknown); the
// verdict then can't be Ready until a person continues without them.
Incomplete bool `json:"incomplete"`
// Problem says why checks are unknown ("api.hostrepute.com timed out…").
Problem string `json:"problem,omitempty"`
Estimates ReadinessEstimates `json:"estimates"`
// contains filtered or unexported fields
}
ReadinessResult is what Assemble produces and a run stores.
func Assemble ¶
func Assemble(f Facts) ReadinessResult
Assemble builds the checklist and the estimates from what a run gathered.
func (ReadinessResult) In ¶
func (r ReadinessResult) In(l i18n.Lang) ReadinessResult
In is the result as a reader reads it.
type ReadinessRoute ¶
type ReadinessRoute struct {
Stream string `json:"stream" enum:"broadcast,automation,system"`
// StreamLabel is "Broadcasts"; SplitLabel "Broadcasts 90 / 10".
StreamLabel string `json:"streamLabel"`
SplitLabel string `json:"splitLabel"`
Policy string `json:"policy" enum:"automatic,pause_and_ask,warm_only"`
Override bool `json:"override"`
TotalCost float64 `json:"totalCost"`
// TotalMinutes is how long the send takes from its start, waits
// included (Timeline); without an estimate, the longest route (routes
// run in parallel) or the slowest mailbox provider throttle.
TotalMinutes int `json:"totalMinutes"`
Down int `json:"down"`
Move *ReadinessHeldMove `json:"move,omitempty"`
// Timeline is when the send's parts go out; nil when the sending engine
// couldn't estimate it.
Timeline *ReadinessTimeline `json:"timeline,omitempty"`
}
ReadinessRoute is the route breakdown with cost and duration estimates.
type ReadinessRouteShare ¶
type ReadinessRouteShare struct {
// StatusLabel is "Healthy", "Warming up · day 9 of 21", "Down since 08:52".
WarmupCap int64 `json:"warmupCap,omitempty"`
// webhooks silent); its share is held.
Available bool `json:"available"`
// Cost in US dollars; PriceLabel is "$0.10 per 1,000" or "self-hosted";
// Pricing is how the provider is paid for.
// Rate is messages per second; RateLabel "14 /s" or "2 /s ramp".
// RateFrom says where the sending engine takes it from: published (the
// provider's own maximum), default (the adapter's, when the provider
// publishes none) or warmup (the plan's ramp).
// Minutes is how long the share sends, waits left out; Days how many
// days a warm-up plan's caps spread it over; OverQuota how many
// messages wait for the provider's 24-hour quota to free up.
}
ReadinessRouteShare is one sending provider's part of the send.
type ReadinessRun ¶
type ReadinessRun struct {
ID string `json:"id"`
CampaignID string `json:"campaignId"`
Trigger string `json:"trigger" enum:"manual,composer,schedule,send_time,approval"`
RanAt time.Time `json:"ranAt"`
// RanBy names who asked for the run: a person, or an API key or agent
// as itself (RanByType). Empty for runs nobody asked for.
RanBy string `json:"ranBy,omitempty"`
// RanByType is set when RanBy names an API key or an agent.
RanByType string `json:"ranByType,omitempty" enum:"api_key,mcp_agent"`
DurationMs int `json:"durationMs"`
// Version is the campaign version the run checked.
Version int `json:"version"`
ReadinessResult
// UnknownAccepted is set when someone chose to continue with provider
// data only.
UnknownAcceptedAt *time.Time `json:"unknownAcceptedAt,omitempty"`
UnknownAcceptedBy string `json:"unknownAcceptedBy,omitempty"`
// Fingerprint is what the run checked; it changes with the content,
// audience, route or schedule.
Fingerprint string `json:"-"`
}
ReadinessRun is a stored run.
func ForReader ¶
func ForReader(ctx context.Context, r *ReadinessRun) *ReadinessRun
ForReader is a run in the request's language (nil stays nil).
func (ReadinessRun) In ¶
func (r ReadinessRun) In(l i18n.Lang) ReadinessRun
In is the run as a reader reads it: its texts in their language and region, or as stored for English readers with the standard formats (API clients, agents) and for runs stored before their texts were kept.
type ReadinessRunFailure ¶
type ReadinessRunFailure struct {
RunID string `json:"runId"`
At time.Time `json:"at"`
// Error is what went wrong, as the code said it (English).
Error string `json:"error"`
}
ReadinessRunFailure is a run that stopped on an error.
type ReadinessRunRef ¶
type ReadinessRunRef struct {
ID string `json:"id"`
RanAt time.Time `json:"ranAt"`
Verdict string `json:"verdict" enum:"ready,warnings,blocked"`
}
ReadinessRunRef names a stored run: what a poll compares with what the screen shows.
type ReadinessSchedule ¶
type ReadinessSchedule struct {
Mode string `json:"mode" enum:"now,at,best_time"`
// Date and Time are local to Timezone ("2026-10-14", "09:00").
Date string `json:"date,omitempty" pattern:"^\\d{4}-\\d{2}-\\d{2}$"`
Time string `json:"time,omitempty" pattern:"^([01]\\d|2[0-3]):[0-5]\\d$"`
Timezone string `json:"timezone,omitempty" maxLength:"64"`
// At is the resulting instant (read-only).
At *time.Time `json:"at,omitempty" readOnly:"true"`
}
ReadinessSchedule is when the campaign goes out: now, at a local date and time in a time zone, or at each recipient's usual open time within 24 h of that time.
func ScheduleView ¶
func ScheduleView(raw json.RawMessage, wsTZ string) ReadinessSchedule
ScheduleView turns the stored schedule into the API shape, in the workspace's zone when the schedule has none.
type ReadinessSendSettings ¶
type ReadinessSendSettings struct {
Thresholds *ReadinessThresholds `json:"thresholds,omitempty"`
Schedule *ReadinessSchedule `json:"schedule,omitempty"`
}
ReadinessSendSettings are the editable settings of Review & send.
type ReadinessTechRow ¶
type ReadinessTechRow struct {
Label string `json:"label"`
Value string `json:"value"`
// Before is what Value replaces (a link the fix rewrites).
Before string `json:"before,omitempty"`
}
ReadinessTechRow is a line of a check's technical details.
type ReadinessThresholds ¶
type ReadinessThresholds struct {
// Bounce rate in percent.
Bounce float64 `json:"bounce" minimum:"0.1" maximum:"20"`
// Complaint rate in percent, overall and per mailbox provider.
Complaint float64 `json:"complaint" minimum:"0.01" maximum:"5"`
MailboxComplaint float64 `json:"mailboxComplaint" minimum:"0.01" maximum:"5"`
// ProviderErrors is the share of failed API calls over 3 minutes, in percent.
ProviderErrors float64 `json:"providerErrors" minimum:"1" maximum:"100"`
// Scope: pause only the affected route or mailbox provider, or the whole campaign.
Scope string `json:"scope" enum:"route,campaign"`
}
ReadinessThresholds are the auto-pause thresholds of a send. The sending engine enforces them; they're stored on campaigns.thresholds as {"bounce":2.0,"complaint":0.10,"mailbox_complaint":0.10,"provider_errors":5,"scope":"route"}.
func ParseThresholds ¶
func ParseThresholds(campaign, workspace json.RawMessage) ReadinessThresholds
ParseThresholds reads a send's thresholds as the sending engine resolves them (engine.ParseThresholds: its defaults, then the workspace's send_thresholds, then the campaign's own, in either spelling), so Review & send shows what the engine enforces.
type ReadinessThrottle ¶
type ReadinessThrottle struct {
Key string `json:"key" enum:"gmail,outlook,yahoo,icloud,other"`
Name string `json:"name"`
Recipients int64 `json:"recipients"`
// Rate is messages per second; 0 means the provider's full rate.
Rate float64 `json:"rate"`
}
ReadinessThrottle is the rate for one mailbox provider.
type ReadinessTimeline ¶
type ReadinessTimeline struct {
Start time.Time `json:"start"`
// End is when the last message goes out. Open is true when a person
// picks the A/B winner: the rest waits for them and End is the
// sample's end.
End time.Time `json:"end"`
Open bool `json:"open,omitempty"`
BestTime bool `json:"bestTime,omitempty"`
// AB is the A/B test's timeline; nil without a test.
AB *ReadinessABTimeline `json:"ab,omitempty"`
// Basis names what the estimate includes; BasisLabel says it ("The
// estimate includes each provider's rate limit, …").
Basis []string `json:"basis"`
BasisLabel string `json:"basisLabel"`
}
ReadinessTimeline is when the parts of the send go out, played out with the sending engine's own rules (SR-5): rates, warm-up caps, quotas, throttles, the A/B wait and best time.
type ReadinessUndoOutcome ¶
type ReadinessUndoOutcome struct {
ReadinessUndoResult
Running *ReadinessProgress `json:"running,omitempty"`
}
ReadinessUndoOutcome is what Undo put back and the run it started (in the background: poll …/readiness/progress).
type ReadinessUndoResult ¶
type ReadinessUndoResult struct {
// Count is how many fixes were undone.
Count int `json:"count"`
// Restored is the version whose content came back (0 when the batch
// changed no content), saved as Version.
Restored int `json:"restored,omitempty"`
Version int `json:"version"`
}
ReadinessUndoResult is what Undo put back.
type Recipient ¶
type Recipient struct {
Email string
MailboxProvider string
Lists []string
Tier string
// Language is the contact's language code as stored.
Language string
}
Recipient is one final recipient, as routing needs it.
func FinalRecipients ¶
func FinalRecipients(ctx context.Context, q *store.Queries, wsID uuid.UUID, audience, sunsetPolicy json.RawMessage, now time.Time) ([]Recipient, error)
FinalRecipients are an audience's final recipients as a run counts them, read with q (the demo gives the Weekly Digest's readers their languages inside its transaction).
type ReputationFacts ¶
type ReputationFacts struct {
// Status is pass, warn, block or unknown (deliverability's verdict).
Status string
// Via is hostrepute, builtin or none; Sources is how many lists.
Via string
Sources int
// Reason explains an unknown status; Outage is HostRepute's error
// ("Couldn't reach api.hostrepute.com (timeout after 30 s, 3 attempts)").
// ReasonText is Reason when Send Readiness wrote it itself.
Reason string
ReasonText Text
Outage string
CheckedAt *time.Time
// DomainSources and IPSources name the lists that check domains and IPs,
// most important first.
DomainSources []string
IPSources []string
// Listings of the campaign's assets.
Listings []ListingFacts
// Domains are the domains the send's reputation rides on: the sending
// domain, its parent (organizational) domain, the providers' return-path
// domains and the tracking domain (SR-2). Empty: the sending domain only.
Domains []DomainAssetFacts
// ReverseDNS is the reverse DNS of the dedicated IPs carrying the send.
ReverseDNS []ReverseDNSFacts
// UncheckedIPs are dedicated IPs carrying the send that Deliverability's
// blocklist checks don't cover yet (a provider began listing them after
// the last run, review GS-10): unknown, never clean (F-3).
UncheckedIPs []string
}
ReputationFacts are the blocklist results (HostRepute or the built-in checks).
type RetryAudienceFacts ¶
RetryAudienceFacts are a retry's: the issue it sends again, and how many of its addresses were blocked for the sender's reputation and haven't had a retry yet (before the audience's own rules leave some out).
type ReverseDNSFacts ¶
type ReverseDNSFacts struct {
IP string
Provider string
// PTR is the IP's reverse DNS name; Status is pass (it resolves back to
// the IP), fail (it doesn't), missing (no PTR) or error (DNS didn't
// answer: Trouble says how, a Trouble* kind).
PTR string
Status string
Trouble string
}
ReverseDNSFacts is the forward-confirmed reverse DNS of a dedicated IP.
type RouteConfig ¶
RouteConfig describes the routing a campaign uses: its override, or the Broadcasts default split. Key changes when the split changes; Label is "SES 90 / Postal 10" and StreamLabel "Broadcasts 90 / 10".
type RouteFacts ¶
type RouteFacts struct {
Stream string
// Policy is the stream's failover policy.
Policy string
Override bool
// NoRoute is true when the stream has no provider.
NoRoute bool
// Fallback is the route's fallback provider, nil without one.
Fallback *FallbackFacts
// Estimate is the send played out with the sending engine's rules
// (SR-5, C4); nil when there is no engine to ask.
Estimate *engine.Estimate
}
RouteFacts is the sending route of the campaign and its providers.
type RouteOverride ¶
RouteOverride is campaigns.route_override: a split that replaces the stream's rules for this campaign ("Send via SES only").
func ParseRouteOverride ¶
func ParseRouteOverride(raw json.RawMessage) *RouteOverride
ParseRouteOverride reads campaigns.route_override (nil when unset).
type RouteShareRef ¶
type RouteShareRef struct {
}
RouteShareRef names a provider of a send's route.
type RuleFacts ¶
type RuleFacts struct {
ID, Name, Kind, Operator, Value, Severity, AppliesTo, Message, AddedBy string
}
RuleFacts is a rule as a run checks it.
type RunArgs ¶
type RunArgs struct {
CampaignID uuid.UUID `json:"campaign_id"`
WorkspaceID uuid.UUID `json:"workspace_id"`
RunID uuid.UUID `json:"run_id"`
Trigger string `json:"trigger"`
By *uuid.UUID `json:"by,omitempty"`
// ActorType, ActorID and ActorName are who asked, as the audit log
// names them (RunOptions.Actor): an API key or agent as itself.
ActorType authz.ActorType `json:"actor_type,omitempty"`
ActorID *uuid.UUID `json:"actor_id,omitempty"`
ActorName string `json:"actor_name,omitempty"`
}
RunArgs is a queued run of a campaign's checks (Start).
func (RunArgs) InsertOpts ¶
func (RunArgs) InsertOpts() river.InsertOpts
InsertOpts implements river.JobArgsWithInsertOpts. A run isn't retried: a failure is recorded and shown, and a person or the schedule starts the next one.
type RunOptions ¶
type RunOptions struct {
Trigger string
// By is the person who asked: nil for jobs, API keys and agents.
By *uuid.UUID
// Actor is who asked as the audit log names them: an API key or agent
// as itself, never as the person who made it. Start keeps the
// request's caller with the queued run, so the worker that runs it
// logs and names them.
Actor *audit.Actor
}
RunOptions describe a run.
type RunWorker ¶
type RunWorker struct {
river.WorkerDefaults[RunArgs]
S *Service
}
RunWorker runs queued Send Readiness runs.
type Schedule ¶
type Schedule struct {
Mode string `json:"mode"`
At string `json:"at,omitempty"`
Timezone string `json:"timezone,omitempty"`
}
Schedule is campaigns.schedule.
func ParseSchedule ¶
func ParseSchedule(raw json.RawMessage) Schedule
ParseSchedule reads campaigns.schedule (mode "now" when unset).
type SegmentResolver ¶
type SegmentResolver interface {
ContactIDs(ctx context.Context, workspaceID, segmentID uuid.UUID) ([]uuid.UUID, error)
}
SegmentResolver lists a segment's contacts (the audience domain's segments.Service). Without one, segments in an audience aren't counted.
type SendDefaults ¶
type SendDefaults struct {
ExcludeUnengaged bool `json:"excludeUnengaged"`
TypedMultiple float64 `json:"typedMultiple" minimum:"1.1" maximum:"20"`
}
SendDefaults are how a workspace's sends count and confirm their audience: the unengaged (the sunset tier) are left out of every send (ExcludeUnengaged), and a sender types the recipient count when the audience is more than TypedMultiple times the usual one.
type SendHold ¶
type SendHold struct {
Kind string `json:"kind" enum:"blocked,new_warning,unknown,audience_change,edited"`
// Keys are the checks behind it (blocks, new warnings, unknown checks)
// or what changed (content, audience, sender, route).
Keys []string `json:"keys"`
// Text is the hold's sentence ("The audience grew to 44,010 (+41.1%
// since you reviewed)"), kept so it reads in each reader's language.
Text Text `json:"text"`
}
SendHold is one reason a send waits.
type SendTimeCheck ¶
type SendTimeCheck struct {
Holds []SendHold `json:"holds"`
// Audience is the fresh run's final count; Confirmed the count the
// person confirmed (0 when nothing was confirmed).
Audience int64 `json:"audience"`
Confirmed int64 `json:"confirmed"`
}
SendTimeCheck is what the send-time recheck found: why the send waits for a person (no hold: it may start), and the fresh count, which a person resuming the send confirms (the typed confirmation uses it).
func CheckSendTime ¶
func CheckSendTime(run ReadinessRun, conf *Confirmation, now Digests) SendTimeCheck
CheckSendTime decides whether a send may start, comparing the fresh run and the campaign as it stands (now) with what was confirmed (conf). Without a confirmation, only blocks hold the send.
func (SendTimeCheck) Held ¶
func (c SendTimeCheck) Held() bool
Held reports whether the send must wait for a person.
type SendingRule ¶
type SendingRule struct {
ID string `json:"id"`
Name string `json:"name"`
// Kind is what the rule checks: link_param (a query parameter on the
// links), link_domain (where links point), subject_length or
// contains_text; Operator how (ruleOperators); Value the parameter,
// the domains (comma-separated, or "shorteners"), the length or the
// text.
Kind string `json:"kind" enum:"link_param,link_domain,subject_length,contains_text"`
Operator string `` /* 134-byte string literal not displayed */
Value string `json:"value"`
Severity string `json:"severity" enum:"warn,block"`
AppliesTo string `json:"appliesTo" enum:"broadcast,automation,both"`
Enabled bool `json:"enabled"`
// Message is shown to senders next to the check.
Message string `json:"message"`
// Description says what the rule checks, in the reader's language
// ("Every link has a utm_campaign query parameter").
Description string `json:"description"`
AddedBy string `json:"addedBy"`
AddedAt time.Time `json:"addedAt"`
// Triggered is the last send a run found breaking the rule.
Triggered *SendingRuleTrigger `json:"triggered,omitempty"`
}
SendingRule is a workspace sending rule.
type SendingRuleInput ¶
type SendingRuleInput struct {
Name string `json:"name" minLength:"1" maxLength:"120"`
Kind string `json:"kind" enum:"link_param,link_domain,subject_length,contains_text"`
Operator string `` /* 134-byte string literal not displayed */
Value string `json:"value" maxLength:"2000"`
Severity string `json:"severity" enum:"warn,block"`
AppliesTo string `json:"appliesTo" enum:"broadcast,automation,both"`
Enabled bool `json:"enabled"`
Message string `json:"message,omitempty" maxLength:"500"`
}
SendingRuleInput adds or changes a rule.
type SendingRuleTrigger ¶
type SendingRuleTrigger struct {
At time.Time `json:"at"`
CampaignID string `json:"campaignId,omitempty"`
Campaign string `json:"campaign"`
// Count is how many links broke it (0 for a subject or a text).
Count int `json:"count"`
// Fixed is true when a later run of that send found it kept.
Fixed bool `json:"fixed"`
}
SendingRuleTrigger is the last send a run found breaking a rule.
type SendingRulesView ¶
type SendingRulesView struct {
Rules []SendingRule `json:"rules"`
Defaults SendDefaults `json:"defaults"`
// SunsetDays is the sunset policy's (contacts unengaged that long are
// left out).
SunsetDays int `json:"sunsetDays"`
// CanManage is true for members who can change the rules; Managers
// names up to two of them ("Linh Nguyen and Marcus Chen"), and Reason
// says why the reader can't.
CanManage bool `json:"canManage"`
Managers []string `json:"managers"`
Reason string `json:"reason,omitempty"`
}
SendingRulesView is Settings › Sending rules.
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Q *store.Queries
Audit *audit.Logger
Log *slog.Logger
Now func() time.Time
// Campaigns runs the composer's content and link checks and saves the
// content changes fixes make.
Campaigns *campaigns.Service
// Deliverability reads blocklists, authentication and provider health.
Deliverability Deliverability
// Segments resolves segment members; nil until the audience domain wires it.
Segments SegmentResolver
// URLs builds the one-click unsubscribe link.
URLs publicurl.Builder
// AfterChange is told when a fix or a send setting changed a campaign.
AfterChange AfterChange
// Languages gives the facts of the Languages group and checks every
// language version; nil leaves them out.
Languages *languages.Service
// Accessibility runs the Accessibility group and its fixes; nil leaves
// the group out.
Accessibility AccessibilityChecker
// Conditional gives the Conditional content group and the poll checks;
// nil leaves them out.
Conditional ConditionalChecker
// Verification gives the address checks in Audience quality; nil
// leaves them out.
Verification VerificationChecker
// Website gives the web checks of a campaign that publishes to the
// website; nil leaves them out.
Website WebsiteChecker
// Sponsor gives the Sponsor block's checks and fixes; nil leaves them
// out.
Sponsor SponsorChecker
// UpgradeOffers finds Upgrade blocks whose offer ended; nil leaves the
// check out.
UpgradeOffers UpgradeOfferChecker
// Grow checks the Referral and Recommendations blocks (Content rows);
// nil leaves them out.
Grow GrowChecker
// Mailbox classifies company domains from their MX records before the
// audience is counted, so throttles and estimates use the mailbox
// provider the send will use (internal/mailbox); nil skips it.
Mailbox MailboxClassifier
// DNS looks up again what Deliverability couldn't (a DNS error is
// Unknown, never a wrong record); nil keeps the stored results.
DNS dnscheck.Resolver
// Links looks domains up live on the URI blocklists (the link domains'
// lookups, shared with the composer): the return-path and tracking
// domains Deliverability doesn't watch; nil leaves them out.
Links contentcheck.BlocklistChecker
// Jobs queues runs (Start); a worker runs them (RunWorker).
Jobs func() JobInserter
// Estimator plays the send out with the sending engine's rules for the
// estimates (SR-5, C4); nil keeps the plain arithmetic.
Estimator Estimator
}
Service runs Send Readiness and applies its fixes.
func (*Service) AcceptUnknown ¶
func (s *Service) AcceptUnknown(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID uuid.UUID, runID uuid.UUID) (ReadinessRun, error)
AcceptUnknown records that a person continues without the checks that couldn't run on the latest run: "Continue with provider data only" when they are all sender reputation data, "Continue without the skipped checks" otherwise (ProviderDataOnly), which the audit entry names.
func (*Service) ApplyFixes ¶
func (s *Service) ApplyFixes(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ReadinessFixesInput) (ReadinessFixResult, error)
ApplyFixes applies one-click fixes to a campaign. Content fixes save a new version through the composer; audience and route fixes change the campaign. Each change is audited, and the batch is kept so Undo can put the campaign back (undo.go), including what was applied before a fix that failed.
func (*Service) Audience ¶
func (s *Service) Audience(ctx context.Context, ws *store.Workspace, raw json.RawMessage) (AudienceFacts, error)
Audience counts the final recipients of a stored audience definition.
func (*Service) Campaign ¶
func (s *Service) Campaign(ctx context.Context, ws *store.Workspace, id uuid.UUID) (store.ReadinessCampaignRow, error)
Campaign loads a campaign as a run sees it.
func (*Service) Confirm ¶
func (s *Service) Confirm(ctx context.Context, q *store.Queries, ws *store.Workspace, c store.ReadinessCampaignRow, run ReadinessRun, by uuid.UUID, acknowledged []string, scheduledAt *time.Time, now time.Time) error
Confirm keeps what a person confirmed as they schedule (or start) a send: the run they reviewed and the warnings they confirmed, for the campaign as it stands. q writes in the caller's transaction.
func (*Service) Confirmed ¶
Confirmed is what was confirmed for a campaign's send; nil when nothing was (a send scheduled through the API before confirmations were kept).
func (*Service) CreateSendingRule ¶
func (s *Service) CreateSendingRule(ctx context.Context, ws *store.Workspace, p *authz.Principal, in SendingRuleInput) (SendingRule, error)
CreateSendingRule adds a rule (workspace:manage, audited).
func (*Service) CurrentFingerprint ¶
func (s *Service) CurrentFingerprint(ctx context.Context, ws *store.Workspace, c store.ReadinessCampaignRow) string
CurrentFingerprint is the fingerprint of the campaign as it stands, language versions included.
func (*Service) DeleteSendingRule ¶
func (s *Service) DeleteSendingRule(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID) error
DeleteSendingRule removes a rule (workspace:manage, audited).
func (*Service) Digests ¶
func (s *Service) Digests(ctx context.Context, ws *store.Workspace, c store.ReadinessCampaignRow) Digests
Digests are the campaign's as it stands.
func (*Service) Dismissed ¶
func (s *Service) Dismissed(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, run *ReadinessRun) error
Dismissed marks the run's warnings dismissed in the composer, with the reasons in the request's language. Runs without such warnings read nothing.
func (*Service) Route ¶
func (s *Service) Route(ctx context.Context, ws *store.Workspace, override json.RawMessage) (RouteConfig, error)
Route returns the routing configuration of a campaign.
func (*Service) Run ¶
func (s *Service) Run(ctx context.Context, ws *store.Workspace, id uuid.UUID, o RunOptions) (ReadinessRun, error)
Run runs every check on a campaign now and stores the result. It returns ErrRunning when a run is already waiting or in progress. Jobs use it (the recheck before a scheduled send); requests queue a run with Start.
func (*Service) SaveSendDefaults ¶
func (s *Service) SaveSendDefaults(ctx context.Context, ws *store.Workspace, p *authz.Principal, in SendDefaults) (SendingRulesView, error)
SaveSendDefaults changes the audience defaults (workspace:manage, audited).
func (*Service) SendingRules ¶
func (s *Service) SendingRules(ctx context.Context, ws *store.Workspace, p *authz.Principal) (SendingRulesView, error)
SendingRules is Settings › Sending rules for a reader.
func (*Service) SetCanary ¶
func (s *Service) SetCanary(ctx context.Context, q *store.Queries, campaignID uuid.UUID, choice string) error
SetCanary keeps the canary choice confirmed with a send (C1): auto, on or off. q writes in the caller's transaction, after Confirm.
func (*Service) Start ¶
func (s *Service) Start(ctx context.Context, ws *store.Workspace, id uuid.UUID, o RunOptions) (*ReadinessProgress, error)
Start queues a run of a campaign's checks (SR-8): the campaign's progress row is claimed at once, so a second start is refused (ErrRunning) while a run waits or runs, and a worker runs the checks in the background. Nothing else is done inside the request.
func (*Service) State ¶
func (s *Service) State(ctx context.Context, campaignID uuid.UUID) (*ReadinessProgress, *ReadinessRunFailure, error)
State is the run waiting or in progress, or the run that failed last.
func (*Service) UndoFixes ¶
func (s *Service) UndoFixes(ctx context.Context, ws *store.Workspace, p *authz.Principal, campaignID, batchID uuid.UUID) (ReadinessUndoResult, error)
UndoFixes puts a campaign back as it was before a batch of fixes. It fails with 409 when the batch was undone already, when it changed what Undo can't put back, or when the campaign changed since (a save, another batch, an audience or route edit): undoing would lose that change. A batch that changed the route needs the right to send or to manage providers, as applying it did.
func (*Service) UndoableFixes ¶
func (s *Service) UndoableFixes(ctx context.Context, c store.ReadinessCampaignRow) (*ReadinessFixBatch, error)
UndoableFixes is the campaign's latest batch of fixes while Undo can put it back: not undone, nothing in it Undo can't restore, and the campaign still as it left it. Nil otherwise.
func (*Service) UpdateSendSettings ¶
func (s *Service) UpdateSendSettings(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in ReadinessSendSettings) error
UpdateSendSettings saves the thresholds and the schedule the person chose. Changing the schedule after approval invalidates the approval.
func (*Service) UpdateSendingRule ¶
func (s *Service) UpdateSendingRule(ctx context.Context, ws *store.Workspace, p *authz.Principal, id uuid.UUID, in SendingRuleInput) (SendingRule, error)
UpdateSendingRule changes a rule, its severity, scope or status (workspace:manage, audited).
type ShareFacts ¶
type ShareFacts struct {
Percent float64
// Status is the provider status (healthy, warming_up, down…).
// DownSince and DownDetail describe an outage ("mta.acme.io has refused
// connections since 08:52 (ECONNREFUSED on port 25 and 443)"); Down says
// it in parts, so it reads in each reader's language.
// Warm-up: day and length of the plan, the cap on the send day and
// whether that day is today.
// Rate is the provider's send rate (messages per second); RateRamp is
// true when it comes from a warm-up plan.
// Bounce and Complaint are 7-day rates in percent (nil without volume);
// ProviderReported is true when the provider measured them. Sent7d is
// the volume ReputeCast's rates count: below MinRateVolume they can't
// judge a provider (SR-5).
// Account is the account standing ("Production · no enforcement").
// BulkAllowed says whether the provider's terms allow bulk marketing;
// Terms explains it ("yes, with production access") and TermsKind names
// the explanation (terms.<kind> in the messages; empty shows Terms).
// IPs are the provider's dedicated IPs (empty for shared pools).
// headers (providers.Capabilities.OneClick): "" as given, "replaced"
// or "unsigned".
OneClick string
}
ShareFacts is one provider of the route with what the checks need.
type SponsorChecker ¶
type SponsorChecker interface {
SponsorFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src string) SponsorFacts
FixSponsor(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src, action string) (next, applied string, err error)
}
SponsorChecker gives the facts of an email's Sponsor block and applies its fixes; nil leaves the checks out.
type SponsorFacts ¶
type SponsorFacts struct {
HasBlock bool
// State is ready (the creative), waiting (a placeholder) or none (no
// booking: the block is left out).
State string
Sponsor string
Issue int
// BookingID and CreativeDue name the booking to open.
BookingID string
CreativeDue *time.Time
// Stale: the creative or the booking changed since the email was saved.
Stale bool
// Labelled: the block carries the "Sponsored" label.
Labelled bool
}
SponsorFacts are what Send Readiness checks of an email's Sponsor block.
type Text ¶
Text is a text of a run, kept for the people who read it later: the messages it is written from, each with its arguments. One message is the text; several are sentences, each ended with a full stop and joined with a space.
Arguments are strings, numbers, other Texts (a phrase inside a sentence) and the values the Arg functions make (lists, money, percentages, times, language names), which are written in each reader's language and region.
func RawText ¶
RawText is text the run didn't write, such as a provider's own words or a DNS record: every reader reads it as it is.
func (Text) In ¶
In writes the text in a reader's language and region. It returns "" when a message isn't known any more: the caller shows the English it stored.
func (Text) MarshalJSON ¶
MarshalJSON stores one message as an object and several as an array.
func (*Text) UnmarshalJSON ¶
UnmarshalJSON reads what MarshalJSON stored.
type UpgradeOfferChecker ¶
type UpgradeOfferChecker interface {
EndedUpgradeOffers(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, src string) []EndedUpgradeOffer
}
UpgradeOfferChecker finds the ended offers of an email's Upgrade blocks; nil leaves the check out.
type VariantReport ¶
type VariantReport struct {
Key string
Subject string
Preheader string
// Content is true for a content test's variant: its own body.
Content bool
Report contentcheck.ContentCheckReport
}
VariantReport is the content check of one A/B variant.
type VerificationChecker ¶
type VerificationChecker interface {
ReadinessFacts(ctx context.Context, ws *store.Workspace, campaignID uuid.UUID, recipients []Recipient, suppressed []string) VerificationFacts
// RiskySegment makes or refreshes a static segment of these risky
// addresses' contacts, for the campaign to exclude.
RiskySegment(ctx context.Context, ws *store.Workspace, campaign string, emails []string) (uuid.UUID, error)
}
VerificationChecker gives the address checks' facts for a run (the verification domain, wired in internal/app) and makes the exclusion.
type VerificationFacts ¶
type VerificationFacts struct {
// Connected is true when a verification service is connected; Ran
// when the checker looked at the audience.
Connected bool
Ran bool
// The service a check would use, its price per check (dollars) and balance.
Service string
ServiceName string
Price float64
Balance *int64
// At risk and Sunset recipients, and those not checked in 90 days.
AtRisk, AtRiskUnchecked int64
Sunset, SunsetUnchecked int64
// When the checked ones were last checked.
AtRiskCheckedOn, SunsetCheckedOn *time.Time
// Risky recipients by reason (catch_all, disposable, role…), their
// addresses (for the exclusion) and when they were checked.
Risky int64
RiskyReasons map[string]int64
RiskyEmails []string
RiskyCheckedOn *time.Time
// InvalidSuppressed counts the audience's contacts a check found invalid,
// already suppressed and left out at send time.
InvalidSuppressed int64
InvalidCheckedOn *time.Time
}
VerificationFacts are the audience's address-check results.
type VersionReport ¶
type VersionReport struct {
Language string
Report contentcheck.ContentCheckReport
// TrackedBytes is the version's HTML as sent, with tracking (SR-7).
TrackedBytes int
}
VersionReport is the content check of one language version.
type WebCheck ¶
type WebCheck struct {
Key string // address, cover, tokens, hidden
Status string // pass, warn, block
Title string
Detail string
// Href opens the composer's Web tab.
Href string
}
WebCheck is one web check of a campaign's post.
Source Files
¶
- abtest.go
- accessibility.go
- api.go
- assemble.go
- audience.go
- build.go
- composer.go
- conditional.go
- confirm.go
- delivery.go
- dismissals.go
- effects.go
- facts.go
- fixes.go
- gather.go
- grow.go
- infra.go
- lang.go
- languages.go
- paid.go
- personalization.go
- retry.go
- route.go
- rules.go
- rules_api.go
- sendtime.go
- service.go
- settings.go
- sponsor.go
- stored.go
- stores.go
- technical.go
- text.go
- types.go
- undo.go
- upgradeoffer.go
- verification.go
- website.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package readinesstest runs Send Readiness in integration tests.
|
Package readinesstest runs Send Readiness in integration tests. |