Documentation
¶
Overview ¶
Package verification checks contacts' addresses with the workspace's own verification service (ZeroBounce, NeverBounce, Kickbox, Bouncer, Emailable): connecting a service with a write-only API key and the plan's price per check, the uses (an import's new addresses, signup forms in real time, lists, segments, tiers, selections, one contact), and what each result does: invalid addresses are suppressed for all mail, risky and unknown ones are tagged, and every contact keeps its latest result.
Addresses leave the instance only on purpose: every use is preceded by a notice that names the service and is audited, and only the addresses are sent. Real-time checks on forms are counted by day, not audited one by one (the roadmap's default for automatic, high-volume events).
Index ¶
- Constants
- Variables
- func Erasure() erasure.Source
- func Helpers(ctx context.Context, q *store.Queries, wsID uuid.UUID, perm authz.Permission) []string
- func JobLabel(l i18n.Lang, j store.VerificationJob) string
- func RegionLabel(service, region string) string
- func Register(h huma.API, s *Service)
- func RegisterJobs(reg *jobs.Registry, s *Service)
- func SealKey(box *secrets.Box, workspaceID uuid.UUID, service, key string, demo bool) ([]byte, error)
- func ServiceName(key string) string
- func SourceService(source string) string
- func SuppressionSource(service string) string
- type Audience
- type AudienceFacts
- type BalanceArgs
- type BalanceWorker
- type ContactAddressCheck
- type Imports
- type JobArgs
- type JobWorker
- type Money
- type Notifier
- type PendingArgs
- type PendingWorker
- type Recipient
- type Selection
- type Service
- func (s *Service) AudienceChecks(ctx context.Context, ws *store.Workspace, recipients []Recipient, ...) (AudienceFacts, error)
- func (s *Service) Cancel(ctx context.Context, ws *store.Workspace, id uuid.UUID) (VerificationJobView, error)
- func (s *Service) CheckPending(ctx context.Context) error
- func (s *Service) CheckSignup(ctx context.Context, ws *store.Workspace, formKey, email string) SignupCheck
- func (s *Service) Connect(ctx context.Context, ws *store.Workspace, in VerificationConnectInput) (VerificationServiceView, error)
- func (s *Service) ContactCheck(ctx context.Context, ws *store.Workspace, contactID uuid.UUID) (ContactAddressCheck, error)
- func (s *Service) Disconnect(ctx context.Context, ws *store.Workspace, service string, forms []string) (VerificationDisconnectResult, error)
- func (s *Service) Estimate(ctx context.Context, ws *store.Workspace, in VerificationEstimateInput) (VerificationEstimate, error)
- func (s *Service) FormSetting(ctx context.Context, ws *store.Workspace, formKey string) (VerificationFormSetting, error)
- func (s *Service) Get(ctx context.Context, ws *store.Workspace, service string) (VerificationServiceView, error)
- func (s *Service) ImportAnswers(ctx context.Context, ws *store.Workspace, importID uuid.UUID) (*imports.ImportChecks, error)
- func (s *Service) ImportResults(ctx context.Context, ws *store.Workspace, importID uuid.UUID) (*store.VerificationJob, map[string]adapter.Answer, error)
- func (s *Service) Job(ctx context.Context, ws *store.Workspace, id uuid.UUID) (VerificationJobView, error)
- func (s *Service) Overview(ctx context.Context, ws *store.Workspace) (VerificationOverview, error)
- func (s *Service) Realtime(ctx context.Context, ws *store.Workspace, service string) (VerificationRealtime, error)
- func (s *Service) RefreshBalances(ctx context.Context) error
- func (s *Service) ReplaceKey(ctx context.Context, ws *store.Workspace, service string, ...) (VerificationServiceView, error)
- func (s *Service) ResultsCSV(ctx context.Context, ws *store.Workspace, id uuid.UUID) ([]byte, string, error)
- func (s *Service) Resume(ctx context.Context, ws *store.Workspace, id uuid.UUID) (VerificationJobView, error)
- func (s *Service) RiskySegment(ctx context.Context, ws *store.Workspace, campaign string, emails []string) (uuid.UUID, error)
- func (s *Service) Run(ctx context.Context, id uuid.UUID, budget time.Duration) (*time.Time, error)
- func (s *Service) SetFormCheck(ctx context.Context, ws *store.Workspace, formKey, formName string, ...) (VerificationFormSetting, error)
- func (s *Service) SignedUp(ctx context.Context, ws *store.Workspace, contactID uuid.UUID, c SignupCheck)
- func (s *Service) Start(ctx context.Context, ws *store.Workspace, in VerificationStartInput) (VerificationJobView, error)
- func (s *Service) TestConnection(ctx context.Context, ws *store.Workspace, service string) (VerificationKeyTest, error)
- func (s *Service) TestKey(ctx context.Context, ws *store.Workspace, in VerificationKeyInput) (VerificationKeyTest, error)
- func (s *Service) TrayJobs(ctx context.Context, ws *store.Workspace) ([]TrayJob, error)
- func (s *Service) UpdateSettings(ctx context.Context, ws *store.Workspace, service string, ...) (VerificationServiceView, error)
- func (s *Service) VerifyContact(ctx context.Context, ws *store.Workspace, contactID uuid.UUID, ...) (ContactAddressCheck, error)
- type SignupCheck
- type SweepArgs
- type SweepWorker
- type TrayJob
- type VerificationCapabilities
- type VerificationConnectInput
- type VerificationDisconnectResult
- type VerificationEstimate
- type VerificationEstimateInput
- type VerificationFormCount
- type VerificationFormInput
- type VerificationFormSetting
- type VerificationJobView
- type VerificationKeyInput
- type VerificationKeyTest
- type VerificationMapping
- type VerificationOverview
- type VerificationRealtime
- type VerificationRealtimeDay
- type VerificationRegion
- type VerificationReplaceKeyInput
- type VerificationServiceChoice
- type VerificationServiceView
- type VerificationSettingsInput
- type VerificationStartInput
- type VerificationTarget
- type VerificationUse
- type VerifyContactInput
Constants ¶
const LowCredits = 1000
LowCredits is the balance under which members with integrations:manage are told.
const RecheckAfter = 72 * time.Hour
RecheckAfter is how long an unknown result waits before it's checked again.
const SignupTimeout = 3 * time.Second
SignupTimeout is how long a signup waits for the service: after 3 seconds the signup goes through and the address is checked later.
const SkipWithin = 90 * 24 * time.Hour
SkipWithin is "Skip addresses checked in the last 90 days".
const SubscribePage = "subscribe_page"
SubscribePage is the form key of the workspace's hosted subscribe page.
Variables ¶
var ( // MJobFinishedTitle and the rest word the notifications (notify.go in // internal/app formats them per recipient). MJobFinishedTitle = msgs.M("notify.jobFinishedTitle") MJobFinishedSummary = msgs.M("notify.jobFinishedSummary") MJobStoppedTitle = msgs.M("notify.jobStoppedTitle") MJobStoppedCredits = msgs.M("notify.jobStoppedCredits") MJobStoppedDown = msgs.M("notify.jobStoppedDown") MJobStoppedKey = msgs.M("notify.jobStoppedKey") MCreditsLowTitle = msgs.M("notify.creditsLowTitle") MCreditsLowSummary = msgs.M("notify.creditsLowSummary") MCreditsLowNeeded = msgs.M("notify.creditsLowNeeded") )
Functions ¶
func Helpers ¶
Helpers names up to three active members who hold perm, narrowest role first and the Owner last ("Ask Sofia Rossi, Marcus Chen or Linh Nguyen").
func JobLabel ¶
func JobLabel(l i18n.Lang, j store.VerificationJob) string
JobLabel names a job the way a notification does, in a reader's language: "Sunset tier", "Product Updates".
func RegionLabel ¶
RegionLabel is where a service processes the addresses ("United States").
func RegisterJobs ¶
RegisterJobs adds the workers and the periodic jobs.
func SealKey ¶
func SealKey(box *secrets.Box, workspaceID uuid.UUID, service, key string, demo bool) ([]byte, error)
SealKey seals an API key for a workspace's service (the demo seeds with it).
func ServiceName ¶
ServiceName is a service's display name ("ZeroBounce").
func SourceService ¶
SourceService returns the service of a suppression source, or "".
func SuppressionSource ¶
SuppressionSource is how a service is recorded as the source of a suppression ("verify:zerobounce").
Types ¶
type Audience ¶
type Audience interface {
// SelectionIDs returns the contacts of a selection that the caller can
// see (list scope included).
SelectionIDs(ctx context.Context, ws *store.Workspace, sel Selection) ([]uuid.UUID, error)
}
Audience resolves the contacts a job checks (internal/audience and internal/segments, wired in internal/app).
type AudienceFacts ¶
type AudienceFacts struct {
Connected bool
Service string
ServiceName string
Price float64
Balance *int64
AtRisk, AtRiskUnchecked int64
Sunset, SunsetUnchecked int64
AtRiskCheckedOn *time.Time
SunsetCheckedOn *time.Time
Risky int64
RiskyReasons map[string]int64
RiskyEmails []string
RiskyCheckedOn *time.Time
InvalidSuppressed int64
InvalidCheckedOn *time.Time
}
AudienceFacts are a send's address-check results for Send Readiness's Audience quality (internal/readiness converts them).
type BalanceWorker ¶
type BalanceWorker struct {
river.WorkerDefaults[BalanceArgs]
Svc *Service
}
BalanceWorker runs BalanceArgs.
func (*BalanceWorker) Work ¶
func (w *BalanceWorker) Work(ctx context.Context, _ *river.Job[BalanceArgs]) error
Work implements river.Worker.
type ContactAddressCheck ¶
type ContactAddressCheck struct {
Checked bool `json:"checked"`
Result string `json:"result,omitempty" enum:"valid,invalid,risky,unknown,"`
Reason string `json:"reason,omitempty"`
Code string `json:"code,omitempty"`
Service string `json:"service,omitempty"`
ServiceName string `json:"serviceName,omitempty"`
CheckedAt *time.Time `json:"checkedAt,omitempty"`
Tag string `json:"tag,omitempty"`
// Suppressed: an invalid result put the address on the suppression list.
Suppressed bool `json:"suppressed"`
SuppressedAt *time.Time `json:"suppressedAt,omitempty"`
// RecheckFrom: an unknown result can be checked again from then.
RecheckFrom *time.Time `json:"recheckFrom,omitempty"`
// What "Verify now" would use: the bulk default, its price and region.
Email string `json:"email"`
VerifyService string `json:"verifyService,omitempty"`
VerifyServiceName string `json:"verifyServiceName,omitempty"`
RegionLabel string `json:"regionLabel,omitempty"`
Price float64 `json:"price"`
Balance *int64 `json:"balance,omitempty"`
Connected bool `json:"connected"`
CanVerify bool `json:"canVerify"`
Helpers []string `json:"helpers"`
}
ContactAddressCheck is the contact profile's address row: "Never checked · Verify now", or "Valid · ZeroBounce · 14 Oct".
type Imports ¶
type Imports interface {
NewAddresses(ctx context.Context, ws *store.Workspace, importID uuid.UUID) (label string, emails []string, err error)
}
Imports gives the new addresses of an import (its preview's).
type JobWorker ¶
type JobWorker struct {
river.WorkerDefaults[JobArgs]
Svc *Service
}
JobWorker runs JobArgs.
type Money ¶
type Money int64
Money is a price in millionths of a dollar.
func FromDollars ¶
FromDollars converts dollars, rounding to a millionth.
type Notifier ¶
type Notifier interface {
JobEnded(ctx context.Context, ws *store.Workspace, j store.VerificationJob)
CreditsLow(ctx context.Context, ws *store.Workspace, svc store.VerificationService, needed int64, job *store.VerificationJob)
}
Notifier tells members about finished jobs and low credits.
type PendingArgs ¶
type PendingArgs struct{}
PendingArgs checks the signups the service didn't answer for in time.
type PendingWorker ¶
type PendingWorker struct {
river.WorkerDefaults[PendingArgs]
Svc *Service
}
PendingWorker runs PendingArgs.
func (*PendingWorker) Work ¶
func (w *PendingWorker) Work(ctx context.Context, _ *river.Job[PendingArgs]) error
Work implements river.Worker.
type Selection ¶
type Selection struct {
ListID *uuid.UUID
SegmentID *uuid.UUID
Tiers []string
ContactIDs []uuid.UUID
// Filter is a Contacts filter (audience.ContactFilter as JSON).
Filter json.RawMessage
}
Selection is what a bulk job checks: a list, a segment, one or more tiers, chosen contacts, or every contact matching a Contacts filter (a saved view).
type Service ¶
type Service struct {
Pool *pgxpool.Pool
Q *store.Queries
Audit *audit.Logger
Box *secrets.Box
Log *slog.Logger
// Audience and Imports resolve what a job checks.
Audience Audience
Imports Imports
Notify Notifier
// Jobs is River's client, read lazily; nil (or Inline) runs jobs in
// the request (tests).
Jobs func() *jobs.Client
Inline bool
// HTTP calls the services; BaseURLs points services at fakes (tests).
HTTP *http.Client
BaseURLs map[string]string
Now func() time.Time
}
Service is the verification domain.
func (*Service) AudienceChecks ¶
func (s *Service) AudienceChecks(ctx context.Context, ws *store.Workspace, recipients []Recipient, suppressed []string) (AudienceFacts, error)
AudienceChecks reads the latest results of a send's final recipients and of its suppressed contacts.
func (*Service) Cancel ¶
func (s *Service) Cancel(ctx context.Context, ws *store.Workspace, id uuid.UUID) (VerificationJobView, error)
Cancel stops a job; the results so far are kept.
func (*Service) CheckPending ¶
CheckPending checks signups that went through without an answer, once the forms' service answers again. Invalid ones are suppressed then.
func (*Service) CheckSignup ¶
func (s *Service) CheckSignup(ctx context.Context, ws *store.Workspace, formKey, email string) SignupCheck
CheckSignup checks a signup's address when the form has real-time checks on. It never blocks a signup on the service: a failure or 3 seconds without an answer lets it through, and the address is checked once the service answers again. Each check is counted by day and form, not audited one by one.
func (*Service) Connect ¶
func (s *Service) Connect(ctx context.Context, ws *store.Workspace, in VerificationConnectInput) (VerificationServiceView, error)
Connect tests the key (it must read the balance) and saves the service with its key sealed.
func (*Service) ContactCheck ¶
func (s *Service) ContactCheck(ctx context.Context, ws *store.Workspace, contactID uuid.UUID) (ContactAddressCheck, error)
ContactCheck returns a contact's latest result and what "Verify now" uses.
func (*Service) Disconnect ¶
func (s *Service) Disconnect(ctx context.Context, ws *store.Workspace, service string, forms []string) (VerificationDisconnectResult, error)
Disconnect removes a service and its key. Results already on contacts and the daily counts of past checks stay.
func (*Service) Estimate ¶
func (s *Service) Estimate(ctx context.Context, ws *store.Workspace, in VerificationEstimateInput) (VerificationEstimate, error)
Estimate says what a use would check and cost.
func (*Service) FormSetting ¶
func (s *Service) FormSetting(ctx context.Context, ws *store.Workspace, formKey string) (VerificationFormSetting, error)
FormSetting returns a form's real-time check.
func (*Service) Get ¶
func (s *Service) Get(ctx context.Context, ws *store.Workspace, service string) (VerificationServiceView, error)
Get returns one service's view.
func (*Service) ImportAnswers ¶
func (s *Service) ImportAnswers(ctx context.Context, ws *store.Workspace, importID uuid.UUID) (*imports.ImportChecks, error)
ImportAnswers gives the import preview and the import the answers of the latest check of an import's new addresses (the import's optional "Verify the new addresses"): nil when none ran.
func (*Service) ImportResults ¶
func (s *Service) ImportResults(ctx context.Context, ws *store.Workspace, importID uuid.UUID) (*store.VerificationJob, map[string]adapter.Answer, error)
ImportResults returns the answers of an import's latest check, by address.
func (*Service) Job ¶
func (s *Service) Job(ctx context.Context, ws *store.Workspace, id uuid.UUID) (VerificationJobView, error)
Job returns a use.
func (*Service) Realtime ¶
func (s *Service) Realtime(ctx context.Context, ws *store.Workspace, service string) (VerificationRealtime, error)
Realtime returns a service's real-time checks since it was connected.
func (*Service) RefreshBalances ¶
RefreshBalances reads every connected service's balance (hourly).
func (*Service) ReplaceKey ¶
func (s *Service) ReplaceKey(ctx context.Context, ws *store.Workspace, service string, in VerificationReplaceKeyInput) (VerificationServiceView, error)
ReplaceKey tests and seals a new key (audited; the key never is).
func (*Service) ResultsCSV ¶
func (s *Service) ResultsCSV(ctx context.Context, ws *store.Workspace, id uuid.UUID) ([]byte, string, error)
ResultsCSV writes a job's results: addresses, so it needs subscribers:export and is audited like an export.
func (*Service) Resume ¶
func (s *Service) Resume(ctx context.Context, ws *store.Workspace, id uuid.UUID) (VerificationJobView, error)
Resume continues a job that stopped for credits or an outage.
func (*Service) RiskySegment ¶
func (s *Service) RiskySegment(ctx context.Context, ws *store.Workspace, campaign string, emails []string) (uuid.UUID, error)
RiskySegment makes or refreshes a static segment of the contacts with these addresses ("Risky addresses · Re-engagement wave 3"), for a campaign to exclude.
func (*Service) Run ¶
Run works on a job for up to budget. It returns when to continue (nil when the job ended).
func (*Service) SetFormCheck ¶
func (s *Service) SetFormCheck(ctx context.Context, ws *store.Workspace, formKey, formName string, in VerificationFormInput) (VerificationFormSetting, error)
SetFormCheck turns real-time checks on or off for a form (audited). It needs forms:edit on top of subscribers:verify.
func (*Service) SignedUp ¶
func (s *Service) SignedUp(ctx context.Context, ws *store.Workspace, contactID uuid.UUID, c SignupCheck)
SignedUp records a checked signup's result on its contact: risky and unknown addresses are tagged (invalid ones never got this far).
func (*Service) Start ¶
func (s *Service) Start(ctx context.Context, ws *store.Workspace, in VerificationStartInput) (VerificationJobView, error)
Start creates a job and queues it. Every use is audited: who, which service, what, how many addresses and the estimated cost.
func (*Service) TestConnection ¶
func (s *Service) TestConnection(ctx context.Context, ws *store.Workspace, service string) (VerificationKeyTest, error)
TestConnection reads a connected service's balance again ("Read the balance again", "Test connection"). It sends no address.
func (*Service) TestKey ¶
func (s *Service) TestKey(ctx context.Context, ws *store.Workspace, in VerificationKeyInput) (VerificationKeyTest, error)
TestKey checks a key by reading the balance. Nothing is saved.
func (*Service) UpdateSettings ¶
func (s *Service) UpdateSettings(ctx context.Context, ws *store.Workspace, service string, in VerificationSettingsInput) (VerificationServiceView, error)
UpdateSettings saves the price and defaults (audited with before and after).
func (*Service) VerifyContact ¶
func (s *Service) VerifyContact(ctx context.Context, ws *store.Workspace, contactID uuid.UUID, in VerifyContactInput) (ContactAddressCheck, error)
VerifyContact checks one contact now: a one-address job, audited like any use, run at once.
type SignupCheck ¶
type SignupCheck struct {
// Service answered (empty when the form doesn't check addresses).
Service string
Answer adapter.Answer
// NoAnswer: the service failed or took more than 3 seconds.
NoAnswer bool
FormKey string
}
SignupCheck is a real-time check's answer for one signup.
func (SignupCheck) Checked ¶
func (c SignupCheck) Checked() bool
Checked reports whether a service answered.
type SweepArgs ¶
type SweepArgs struct{}
SweepArgs requeues jobs that are due (after a restart, or a pause's next try).
type SweepWorker ¶
type SweepWorker struct {
river.WorkerDefaults[SweepArgs]
Svc *Service
}
SweepWorker runs SweepArgs.
type TrayJob ¶
type TrayJob struct {
ID string
Title string
Status string // queued, running, done, failed, canceled
Progress *int
Eta string
Detail string
Href string
StartedAt *time.Time
FinishedAt *time.Time
}
TrayJob is a verification job in the background-jobs tray: running ones with their progress, and ones that ended in the last two hours.
type VerificationCapabilities ¶
type VerificationCapabilities struct {
BulkLists bool `json:"bulkLists"`
RealTime bool `json:"realTime"`
CatchAll bool `json:"catchAll"`
CreditBalance bool `json:"creditBalance"`
DataRegion bool `json:"dataRegion"`
}
VerificationCapabilities are a service's catalog badges.
type VerificationConnectInput ¶
type VerificationConnectInput struct {
VerificationKeyInput
Price float64 `json:"price" minimum:"0" maximum:"10" doc:"Price per check in dollars"`
DefaultBulk bool `json:"defaultBulk"`
DefaultForms bool `json:"defaultForms"`
}
VerificationConnectInput connects a service.
type VerificationDisconnectResult ¶
type VerificationDisconnectResult struct {
Service string `json:"service"`
// Forms that stopped checking addresses as people sign up.
Forms []string `json:"forms"`
// Bulk is true when imports and bulk checks no longer offer it.
Bulk bool `json:"bulk"`
}
VerificationDisconnectResult says what stopped.
type VerificationEstimate ¶
type VerificationEstimate struct {
Kind string `json:"kind"`
Label string `json:"label"`
// Contacts in the target; Skipped of them checked in the last 90 days.
Contacts int64 `json:"contacts"`
Skipped int64 `json:"skipped"`
// SkippedService and SkippedOn describe the skipped ones' last check
// ("Skips 3,615 checked with ZeroBounce on 14 Oct").
SkippedService string `json:"skippedService,omitempty"`
SkippedOn *time.Time `json:"skippedOn,omitempty"`
ToCheck int64 `json:"toCheck"`
SkipRecent bool `json:"skipRecent"`
// The service it would use (the bulk default unless another is picked).
Service string `json:"service,omitempty"`
ServiceName string `json:"serviceName,omitempty"`
RegionLabel string `json:"regionLabel,omitempty"`
Price float64 `json:"price"`
Cost float64 `json:"cost"`
Balance *int64 `json:"balance,omitempty"`
BalanceAt *time.Time `json:"balanceAt,omitempty"`
After *int64 `json:"after,omitempty"`
// Enough is false when the balance doesn't cover the checks (the job
// still starts and stops when the credits run out).
Enough bool `json:"enough"`
Services []VerificationServiceChoice `json:"services"`
// Connected: any service is connected.
Connected bool `json:"connected"`
CanVerify bool `json:"canVerify"`
VerifyHelpers []string `json:"verifyHelpers"`
CanManage bool `json:"canManage"`
ManageHelpers []string `json:"manageHelpers"`
}
VerificationEstimate is what a use would send and cost, for the dialog and its notice.
type VerificationEstimateInput ¶
type VerificationEstimateInput struct {
Target VerificationTarget `json:"target"`
Service string `json:"service,omitempty" enum:"zerobounce,kickbox,neverbounce,bouncer,emailable,"`
SkipRecent *bool `json:"skipRecent,omitempty" doc:"Skip addresses checked in the last 90 days (default true)"`
}
VerificationEstimateInput asks for an estimate.
type VerificationFormCount ¶
type VerificationFormCount struct {
FormKey string `json:"formKey"`
Name string `json:"name"`
Checks int64 `json:"checks"`
Valid int64 `json:"valid"`
Invalid int64 `json:"invalid"`
Risky int64 `json:"risky"`
Unknown int64 `json:"unknown"`
NoAnswer int64 `json:"noAnswer"`
}
VerificationFormCount is one form's real-time checks.
type VerificationFormInput ¶
type VerificationFormInput struct {
Enabled bool `json:"enabled"`
}
VerificationFormInput turns a form's real-time check on or off.
type VerificationFormSetting ¶
type VerificationFormSetting struct {
FormKey string `json:"formKey"`
Enabled bool `json:"enabled"`
Service string `json:"service,omitempty" doc:"The forms default service; empty when there is none"`
ServiceName string `json:"serviceName,omitempty"`
Price float64 `json:"price"`
// AskedToFix is the last 30 days' invalid answers: signups asked to
// fix their address.
AskedToFix int64 `json:"askedToFix"`
// Down and Waiting: the service isn't answering, and how many signups
// went through to be checked when it's back.
Down bool `json:"down"`
Waiting int64 `json:"waiting"`
// CanChange: forms:edit and subscribers:verify.
CanChange bool `json:"canChange"`
Helpers []string `json:"helpers"`
}
VerificationFormSetting is a form's real-time check, for the form builder's Spam protection and its 30-day numbers.
type VerificationJobView ¶
type VerificationJobView struct {
ID string `json:"id"`
Kind string `json:"kind" enum:"import,list,segment,tier,selection,contact"`
Label string `json:"label"`
Origin string `json:"origin"`
Service string `json:"service"`
ServiceName string `json:"serviceName"`
RegionLabel string `json:"regionLabel"`
Status string `json:"status" enum:"queued,running,paused,stopped,cancelled,finished"`
StopReason string `json:"stopReason" enum:",no_credits,service_down,key_rejected,cancelled"`
Total int64 `json:"total"`
Skipped int64 `json:"skipped"`
Checked int64 `json:"checked"`
Valid int64 `json:"valid"`
Invalid int64 `json:"invalid"`
Risky int64 `json:"risky"`
Unknown int64 `json:"unknown"`
Suppressed int64 `json:"suppressed"`
// Reasons counts the invalid and risky answers by reason
// (invalid_address, spam_trap, catch_all, role, disposable…).
Reasons map[string]int64 `json:"reasons"`
Price float64 `json:"price"`
Cost float64 `json:"cost"`
Estimated float64 `json:"estimated"`
BalanceBefore *int64 `json:"balanceBefore,omitempty"`
BalanceAfter *int64 `json:"balanceAfter,omitempty"`
StartedBy string `json:"startedBy"`
StoppedBy string `json:"stoppedBy,omitempty"`
CreatedAt time.Time `json:"createdAt"`
StartedAt *time.Time `json:"startedAt,omitempty"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
// ETASeconds while running, at the service's pace.
ETASeconds *int64 `json:"etaSeconds,omitempty"`
// RecheckFrom: unknown results can be checked again from then.
RecheckFrom *time.Time `json:"recheckFrom,omitempty"`
ErrorSince *time.Time `json:"errorSince,omitempty"`
NextTryAt *time.Time `json:"nextTryAt,omitempty"`
RetryUntil *time.Time `json:"retryUntil,omitempty"`
LastError string `json:"lastError,omitempty"`
ListID string `json:"listId,omitempty"`
ImportID string `json:"importId,omitempty"`
CampaignID string `json:"campaignId,omitempty"`
Tiers []string `json:"tiers"`
CanVerify bool `json:"canVerify"`
CanExport bool `json:"canExport"`
}
VerificationJobView is a use's progress and results.
type VerificationKeyInput ¶
type VerificationKeyInput struct {
Service string `json:"service" enum:"zerobounce,kickbox,neverbounce,bouncer,emailable"`
APIKey string `json:"apiKey" minLength:"8" maxLength:"500"`
Region string `json:"region,omitempty" enum:"us,eu,"`
}
VerificationKeyInput tests or saves a service's API key.
type VerificationKeyTest ¶
type VerificationKeyTest struct {
OK bool `json:"ok"`
Balance *int64 `json:"balance,omitempty"`
Status int `json:"status,omitempty" doc:"The service's HTTP status when it refused"`
Problem string `json:"problem,omitempty"`
At time.Time `json:"at"`
Kind string `json:"kind,omitempty" enum:"key_rejected,no_credits,unreachable,"`
Error *time.Time `json:"error,omitempty"`
}
VerificationKeyTest is "Test connection": the key reads the balance and no address is sent.
type VerificationMapping ¶
type VerificationMapping struct {
Codes []string `json:"codes"`
Result string `json:"result" enum:"valid,invalid,risky,unknown"`
Reason string `json:"reason,omitempty"`
// Tag is what a risky or unknown answer tags the contact with.
Tag string `json:"tag,omitempty"`
}
VerificationMapping is one row of "How ZeroBounce's answers map".
type VerificationOverview ¶
type VerificationOverview struct {
Services []VerificationServiceView `json:"services"`
DefaultBulk string `json:"defaultBulk,omitempty"`
DefaultForms string `json:"defaultForms,omitempty"`
// Uses of the last 30 days, newest first.
Uses []VerificationUse `json:"uses"`
// CanManage: integrations:manage (connect, change, remove).
CanManage bool `json:"canManage"`
ManageHelpers []string `json:"manageHelpers"`
// CanVerify: subscribers:verify (send addresses to a service).
CanVerify bool `json:"canVerify"`
VerifyHelpers []string `json:"verifyHelpers"`
}
VerificationOverview is Settings › Integrations › Verification services.
type VerificationRealtime ¶
type VerificationRealtime struct {
Service string `json:"service"`
Since *time.Time `json:"since,omitempty"`
Checks int64 `json:"checks"`
Spent float64 `json:"spent"`
AskedToFix int64 `json:"askedToFix"`
Forms []VerificationFormCount `json:"forms"`
Total VerificationFormCount `json:"total"`
Days []VerificationRealtimeDay `json:"days"`
Waiting int64 `json:"waiting"`
}
VerificationRealtime is a service's real-time checks by form and by day (the forms default's page).
type VerificationRealtimeDay ¶
type VerificationRealtimeDay struct {
Day string `json:"day" doc:"YYYY-MM-DD"`
Checks int64 `json:"checks"`
}
VerificationRealtimeDay is one day's real-time checks.
type VerificationRegion ¶
VerificationRegion is a data region a service offers.
type VerificationReplaceKeyInput ¶
type VerificationReplaceKeyInput struct {
APIKey string `json:"apiKey" minLength:"8" maxLength:"500"`
}
VerificationReplaceKeyInput replaces a service's API key.
type VerificationServiceChoice ¶
type VerificationServiceChoice struct {
Key string `json:"key"`
Name string `json:"name"`
Balance *int64 `json:"balance,omitempty"`
Price float64 `json:"price"`
Default bool `json:"default"`
RegionLabel string `json:"regionLabel"`
}
VerificationServiceChoice is a connected service in the dialog's select.
type VerificationServiceView ¶
type VerificationServiceView struct {
Key string `json:"key" enum:"zerobounce,kickbox,neverbounce,bouncer,emailable"`
Name string `json:"name"`
Initials string `json:"initials"`
Capabilities VerificationCapabilities `json:"capabilities"`
Regions []VerificationRegion `json:"regions"`
Website string `json:"website"`
KeyHelp string `json:"keyHelp"`
Mappings []VerificationMapping `json:"mappings"`
Connected bool `json:"connected"`
// Status: not_connected, connected, low_credits (under 1,000 or less
// than a waiting job needs) or error (the last call failed).
Status string `json:"status" enum:"not_connected,connected,low_credits,error"`
// Region and RegionLabel: where addresses are processed ("United States").
Region string `json:"region"`
RegionLabel string `json:"regionLabel"`
Price float64 `json:"price" doc:"Price per check in dollars, from the workspace's plan"`
PriceBy string `json:"priceBy,omitempty" doc:"Who entered the price"`
DefaultBulk bool `json:"defaultBulk"`
DefaultForms bool `json:"defaultForms"`
Balance *int64 `json:"balance,omitempty"`
BalanceAt *time.Time `json:"balanceAt,omitempty"`
ConnectedBy string `json:"connectedBy,omitempty"`
ConnectedAt *time.Time `json:"connectedAt,omitempty"`
LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`
LastUsedBy string `json:"lastUsedBy,omitempty"`
LastUsedWhat string `json:"lastUsedWhat,omitempty"`
// The last error, when it happened and since when the service failed.
LastError string `json:"lastError,omitempty"`
LastErrorAt *time.Time `json:"lastErrorAt,omitempty"`
LastErrorSince *time.Time `json:"lastErrorSince,omitempty"`
// Down: the service failed and hasn't answered since.
Down bool `json:"down"`
LastSuccessAt *time.Time `json:"lastSuccessAt,omitempty"`
LastSuccessWhat string `json:"lastSuccessWhat,omitempty"`
TestedAt *time.Time `json:"testedAt,omitempty"`
TestOK *bool `json:"testOk,omitempty"`
// Last 30 days: checks, bulk uses and what they cost.
Checks30d int64 `json:"checks30d"`
BulkUses30d int64 `json:"bulkUses30d"`
Spent30d float64 `json:"spent30d"`
// Needed is a waiting job's size when the balance can't cover it.
Needed int64 `json:"needed,omitempty"`
NeededLabel string `json:"neededLabel,omitempty"`
// PausedJob is a job waiting for the service to answer again.
PausedJob string `json:"pausedJob,omitempty"`
}
VerificationServiceView is one service on the Verification services page: what it can do and, when connected, its settings and health. The API key is never returned.
type VerificationSettingsInput ¶
type VerificationSettingsInput struct {
Price float64 `json:"price" minimum:"0" maximum:"10"`
Region string `json:"region,omitempty" enum:"us,eu,"`
DefaultBulk bool `json:"defaultBulk"`
DefaultForms bool `json:"defaultForms"`
}
VerificationSettingsInput changes a service's price, region and default uses.
type VerificationStartInput ¶
type VerificationStartInput struct {
Target VerificationTarget `json:"target"`
Service string `json:"service,omitempty" enum:"zerobounce,kickbox,neverbounce,bouncer,emailable,"`
SkipRecent *bool `json:"skipRecent,omitempty"`
// Origin is the screen it started from (list_health, readiness,
// contacts, profile, import, segments, growth).
Origin string `json:"origin,omitempty" enum:"list_health,readiness,contacts,profile,import,segments,growth,"`
CampaignID string `json:"campaignId,omitempty"`
}
VerificationStartInput starts a use.
type VerificationTarget ¶
type VerificationTarget struct {
Kind string `json:"kind" enum:"list,segment,tier,selection,contact,import"`
ListID string `json:"listId,omitempty"`
SegmentID string `json:"segmentId,omitempty"`
Tiers []string `json:"tiers,omitempty" maxItems:"4"`
// ContactIDs are chosen contacts (Contacts' selection), Filter every
// contact matching a Contacts filter or saved view.
ContactIDs []string `json:"contactIds,omitempty" maxItems:"10000"`
Filter *audience.ContactFilter `json:"filter,omitempty"`
ContactID string `json:"contactId,omitempty"`
ImportID string `json:"importId,omitempty"`
// Label names the selection or saved view ("Beta applicants from Typeform").
Label string `json:"label,omitempty" maxLength:"200"`
}
VerificationTarget is what a bulk use checks.
type VerificationUse ¶
type VerificationUse struct {
ID string `json:"id"`
Kind string `json:"kind" enum:"import,list,segment,tier,selection,contact,realtime"`
Service string `json:"service"`
ServiceName string `json:"serviceName"`
At time.Time `json:"at"`
By string `json:"by"`
Label string `json:"label"`
Status string `json:"status"`
Addresses int64 `json:"addresses"`
Cost float64 `json:"cost"`
Valid int64 `json:"valid"`
Invalid int64 `json:"invalid"`
Risky int64 `json:"risky"`
Unknown int64 `json:"unknown"`
Suppressed int64 `json:"suppressed"`
NoAnswer int64 `json:"noAnswer"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
// Forms: the real-time row's checks per form ("Newsletter signup (338)").
Forms []VerificationFormCount `json:"forms"`
}
VerificationUse is one use of a service: a bulk job, or a service's real-time checks on signup forms since it became the forms default.
type VerifyContactInput ¶
type VerifyContactInput struct {
Service string `json:"service,omitempty" enum:"zerobounce,kickbox,neverbounce,bouncer,emailable,"`
}
VerifyContactInput picks the service for "Verify now".
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package adapter is the contract every address verification service implements (ZeroBounce, NeverBounce, Kickbox, Bouncer, Emailable), like internal/providers is for sending providers: a descriptor with the service's capabilities and the codes it answers, plain HTTP calls with the workspace's own API key, and answers mapped to ReputeCast's four results with the service's own code kept beside them.
|
Package adapter is the contract every address verification service implements (ZeroBounce, NeverBounce, Kickbox, Bouncer, Emailable), like internal/providers is for sending providers: a descriptor with the service's capabilities and the codes it answers, plain HTTP calls with the workspace's own API key, and answers mapped to ReputeCast's four results with the service's own code kept beside them. |
|
bouncer
Package bouncer checks addresses with Bouncer's v1.1 API (https://docs.usebouncer.com): GET /v1.1/credits and GET /v1.1/email/verify, authenticated with the x-api-key header.
|
Package bouncer checks addresses with Bouncer's v1.1 API (https://docs.usebouncer.com): GET /v1.1/credits and GET /v1.1/email/verify, authenticated with the x-api-key header. |
|
contracttest
Package contracttest is the shared suite every verification service adapter passes, like the sending adapters' suite: registration and capabilities, the balance (which sends no address), each of the four results with the service's own code, batches in order, and the errors jobs act on (a rejected key, no credits, rate limits, an outage), against a fake of the service's API that serves recorded answers.
|
Package contracttest is the shared suite every verification service adapter passes, like the sending adapters' suite: registration and capabilities, the balance (which sends no address), each of the four results with the service's own code, batches in order, and the errors jobs act on (a rejected key, no credits, rate limits, an outage), against a fake of the service's API that serves recorded answers. |
|
emailable
Package emailable checks addresses with Emailable's v1 API (https://emailable.com/docs/api): GET /v1/account and GET /v1/verify with the key as api_key.
|
Package emailable checks addresses with Emailable's v1 API (https://emailable.com/docs/api): GET /v1/account and GET /v1/verify with the key as api_key. |
|
kickbox
Package kickbox checks addresses with Kickbox's v2 API (https://docs.kickbox.com): GET /v2/verify and GET /v2/balance with the key as the apikey parameter.
|
Package kickbox checks addresses with Kickbox's v2 API (https://docs.kickbox.com): GET /v2/verify and GET /v2/balance with the key as the apikey parameter. |
|
neverbounce
Package neverbounce checks addresses with NeverBounce's v4.2 API (https://developers.neverbounce.com): GET /v4.2/account/info and GET /v4.2/single/check with the key as the key parameter.
|
Package neverbounce checks addresses with NeverBounce's v4.2 API (https://developers.neverbounce.com): GET /v4.2/account/info and GET /v4.2/single/check with the key as the key parameter. |
|
zerobounce
Package zerobounce checks addresses with ZeroBounce's v2 API (https://www.zerobounce.net/docs/email-validation-api-quickstart/): GET /v2/getcredits, GET /v2/validate and POST /v2/validatebatch, on the default, United States or EU endpoint.
|
Package zerobounce checks addresses with ZeroBounce's v2 API (https://www.zerobounce.net/docs/email-validation-api-quickstart/): GET /v2/getcredits, GET /v2/validate and POST /v2/validatebatch, on the default, United States or EU endpoint. |