Commit graph

5 commits

Author SHA1 Message Date
DJP
c1bd575bf9 Add --auth-pfx-v2 support to A4 Webhook Monitor for production 2025-11-26 15:39:00 -05:00
DJP
0d69c2b37f Update A4 webhook monitor to process all campaigns at once
- Changed from single-campaign mode to process all A4 campaigns in one run
- Added summary statistics (total found, webhooks sent, already processed, failed)
- Since webhooks are lightweight operations, processing all at once is efficient
- Duplicate prevention still works via database tracking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 17:34:24 -05:00
DJP
89d36fc6b6 Fix campaign_number NULL constraint violation in A4 webhook
- Changed campaign.get('campaign_id', 'N/A') to use 'or' operator
- Now returns 'UNKNOWN' instead of None when campaign_id is missing
- Prevents NULL constraint violation in campaign_status table

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 16:40:21 -05:00
DJP
5f6d24c550 Fix timestamp bug in campaign status recording
- Fixed database.py line 479: Changed 'CURRENT_TIMESTAMP' string to actual datetime
- Added datetime import for proper UTC timestamp generation
- This fixes the PostgreSQL error: invalid input syntax for type timestamp
- Added migration file for campaign_status table

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 16:34:46 -05:00
DJP
6b49ee5e9e Add A4 webhook monitor and Live Campaign field to webhooks
New A4 monitoring script + updated A1→A2 webhook with Live Campaign indicator.

NEW SCRIPT: a4_webhook_monitor.py
- Monitors campaigns with status A4
- Sends webhook when A4 campaigns found
- A4 = Campaign NOT going live
- Webhook payload includes: "live_campaign": "NO"

A4 WEBHOOK PAYLOAD:
{
  "campaign_id": "abc123...",
  "campaign_number": "C000000078",
  "campaign_name": "Campaign Name",
  "status": "A4",
  "live_campaign": "NO",     ← NEW FIELD!
  "timestamp": 1234567890,
  "message": "Campaign marked A4 - Not going live"
}

A1→A2 WEBHOOK UPDATE:
Added "live_campaign": "YES" to existing webhook
- A1→A2 campaigns ARE going live
- Webhook now includes live campaign indicator

A1→A2 WEBHOOK PAYLOAD (UPDATED):
{
  "campaign_id": "abc123...",
  "campaign_number": "C000000078",
  "campaign_name": "Campaign Name",
  "old_status": "A1",
  "new_status": "A2",
  "live_campaign": "YES",    ← NEW FIELD!
  "asset_count": 5,
  "processed_assets": [...],
  "timestamp": 1234567890
}

EMAIL NOTIFICATION:
NEW: a4_webhook_sent template
- Gray theme for A4 status
- Shows "Live Campaign: NO" prominently
- Lists webhook URL and payload details

USAGE:
  Default (OAuth2):
    python scripts/a4_webhook_monitor.py

  With mTLS:
    python scripts/a4_webhook_monitor.py --auth-pfx

CRON SCHEDULE (same as other workflows):
  */5 * * * * cd ~/Python-Version && venv/bin/python scripts/a4_webhook_monitor.py >> logs/cron_a4.log 2>&1

WORKFLOW SUMMARY:
- A1→A2: Webhook with "live_campaign": "YES" (going live)
- A4: Webhook with "live_campaign": "NO" (not going live)
- A5→A6: No webhook (rework workflow)
- B1→B2: No webhook (global masters)

Changes:
- NEW: scripts/a4_webhook_monitor.py (200 lines)
- EDIT: scripts/a1_to_a2_download.py (added live_campaign: YES)
- EDIT: scripts/shared/notifier.py (added a4_webhook_sent template)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 16:34:46 -05:00