Multipub (subscription data)#
Purpose: Subscriber lookup and subscription validation before marking someone inactive (cross-check against subscription signals). Treated as subscription / marketing-owned data for most mutations.
Code: src/auto_responder/services/databases/multipub.py
Configuration#
| Setting | Notes |
|---|---|
MULTIPUB_ORDER_SERVER, MULTIPUB_ORDER_DATABASE, MULTIPUB_ORDER_USER, MULTIPUB_ORDER_PASSWORD | Primary pattern: connection to the order server DB that exposes Multipub via linked server / OPENQUERY (see get_multipub_connection_string() in config.py). |
MULTIPUB_CONNECTION_STRING | Alternative full connection string when order-server fields are not used. |
multipub_order_request_timeout | Request timeout for Multipub SQL (milliseconds in settings; used when building queries). |
Contact lookup#
| Call | Purpose |
|---|---|
lookup_by_email | Primary subscriber match |
(Other lookup helpers exist on the class for user ID / name+org; validation uses fields from the matched subscriber.)
Action engine touches#
Validation (INACTIVE path)#
| Call | Purpose |
|---|---|
validate_for_inactive(...) | Match subscriber; load active orders, recently expired (12 months), recent single-issue; set should_flag_for_review, review_reason |
Downstream effects:
- Active subscriptions: processing defers — inactive marking halted; row queues for
notify_multipub_subscriber_followup_batch(Angel + Yogesh, Matt Cc); outcomeDEFERRED MULTIPUBstyle handling. - Undetermined sender: queues for
notify_tarun_undetermined_sender_reviewat end of run.
Reads after validation#
| Call | Purpose |
|---|---|
check_active_subscription(subsnum) | INACTIVE path — if Multipub still “active” in check, adds Multipub to subscription notification list |
Writes — intentionally skipped in action_engine#
For INACTIVE, changed-email, title-update, and ACTIVE flows, the engine logs "Skip … — marketing team handles" and records a skip action instead of calling:
update_contact_statusupdate_contact_emailupdate_contact_title
So routine pipeline processing does not mutate Multipub, even though the connector implements write methods for operational flexibility / future use.
OUT_OF_OFFICE never reaches validate_for_inactive or any Multipub read beyond the original contact lookup — _handle_out_of_office short-circuits to Human Review.
Read-only / dry-run#
- Read-only: Wrapper intercepts any would-be writes if something called them; validation reads are live.
- Dry-run:
MockMultipubDatabase— no live subscription SQL.
Notifications#
notify_multipub_subscriber_followup_batch— Angel + Yogesh (Matt Cc) when sender is determined and Multipub shows active / recent subscription or purchase evidence.notify_tarun_undetermined_sender_review— Tarun queue when the sender email could not be determined.notify_multipub_subscriber_followup_from_upload— Angel + Yogesh after Tarun uploadoutcome=yes.output_document_multipub_audit.csvis still written for engineering review but is not bulk-emailed to Tarun.
Tarun upload feedback loop#
Once Tarun has reviewed the Multipub audit deliverable, he uploads the reviewed file back through the FastAPI microservice (started automatically with auto-responder, or via the dedicated script):
| Detail | Value |
|---|---|
| Console script | auto-responder-tarun-upload |
| Entry point | src/auto_responder/services/tarun_upload_api.py (create_app, main) |
| Route | POST /multipub/upload (health check at GET /healthz) |
| Persistence dir | TARUN_UPLOAD_DIR env var (default ./tarun_uploads) |
| Embedded startup controls | TARUN_UPLOAD_API_ENABLED, TARUN_UPLOAD_API_HOST (default 0.0.0.0 so the API is reachable on the LAN), TARUN_UPLOAD_API_PORT, TARUN_UPLOAD_API_KEEP_ALIVE_AFTER_BATCH |
| Allowed suffixes | .csv, .json, .xlsx, .xls, .tsv |
| Client Services email (Yes path) | notify_multipub_subscriber_followup_from_upload — Angel + Yogesh To, Matt Cc (same shape as batch 1.1) |
| Install | pip install -e . (FastAPI packages are in base dependencies) |
The endpoint copies the upload into TARUN_UPLOAD_DIR/<timestamp>_<filename> and triggers EmailService.send_email with the reviewed file attached, closing the loop without a manual hand-off.
Output artifacts#
- Multipub subsnum and validation flags on inactive-person / undeliverable records
multipub_sales_requesthint on new-org list when validation showed relevant subscription activity
Related#
- salesforce.html — Salesforce Contacts tied to Multipub are often skipped for updates alongside Multipub skips
- cupola.html — parallel inactive workflow