Files
ALwrity/backend/services/integrations
ajaysi 923fa671fe feat: ContentGuardianAgent, onboarding UX, Team Activity action wiring, docs, agent help modal
ContentGuardianAgent consolidation:
- Merge 3 duplicate classes into single source in specialized/content_guardian.py
- Watchdog audit_committee() with heuristic scoring, coverage gaps, overlaps, alerts
- Remove misleading rejection_rate() helper; use acceptance_rate directly
- Integrate audit + alerts + trend signals into today_workflow_service.py

Team Activity page:
- QualityAuditPanel: health ring, per-agent critiques, coverage gaps, overlaps
- TrendSignalsPanel: opportunity cards with urgency/impact/coverage bars
- AlertBanner: persistent dismiss via POST /alerts/{id}/mark-read
- AgentHelpModal: dialog showing all 8 agents with descriptions, tools, schedule
- QualityAuditPanel action buttons: Fill gap -> /content-planning, Resolve overlap, View CTA on alerts/issues
- TrendSignalsPanel action buttons: Create content from this trend -> /blog-writer with trend context state

Onboarding system:
- Step 4 validation: no auto-pass via basic_ready; requires persona data or explicit progression
- Step 5 validation: logs warning on auto-pass without integration data
- OnboardingCompletionService: single DB session, transactional task creation, upsert pattern
- Business-without-website: nullable website_url on SIFIndexingTask and MarketTrendsTask
- DeepCompetitorAnalysisExecutor: 5-min timeout, 10-competitor cap, asyncio.wait_for
- Persona generation: async with 30s timeout, falls back to scheduler
- OnboardingProgressService.reset_onboarding(): resets session + pauses all DB tasks
- OnboardingControlService.reset_onboarding(): also cancels APScheduler jobs
- FinalStep TaskSchedulingPanel: shows scheduled/failed tasks after completion, 8s auto-redirect
- onboarding_completed agent activity event logged to feed

Documentation:
- docs-site/features/onboarding/: overview, steps, scheduler-tasks, technical-reference (4 pages)
- docs-site/mkdocs.yml: added Onboarding System nav section
- docs-site/features/sif-agents/: overview, agent-directory, committee-system, content-guardian (4 pages)
- docs-site/features/team-activity/: overview, quality-audit, trend-signals, alert-system (4 pages)
- docs-site/features/todays-workflow/: updated overview, technical-architecture, workflow-guide, api-reference
2026-06-01 12:24:31 +05:30
..

WordPress Integration Service

A comprehensive WordPress integration service for ALwrity that enables seamless content publishing to WordPress sites.

Architecture

Core Components

  1. WordPressService (wordpress_service.py)

    • Manages WordPress site connections
    • Handles site credentials and authentication
    • Provides site management operations
  2. WordPressContentManager (wordpress_content.py)

    • Manages WordPress content operations
    • Handles media uploads and compression
    • Manages categories, tags, and posts
    • Provides WordPress REST API interactions
  3. WordPressPublisher (wordpress_publisher.py)

    • High-level publishing service
    • Orchestrates content creation and publishing
    • Manages post references and tracking

Features

Site Management

  • Connect multiple WordPress sites
  • Site credential management
  • Connection testing and validation
  • Site disconnection

Content Publishing

  • Blog post creation and publishing
  • Media upload with compression
  • Category and tag management
  • Featured image support
  • SEO metadata (meta descriptions)
  • Draft and published status control

Advanced Features

  • Image compression for better performance
  • Automatic category/tag creation
  • Post status management
  • Post deletion and updates
  • Publishing history tracking

Database Schema

WordPress Sites Table

CREATE TABLE wordpress_sites (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id TEXT NOT NULL,
    site_url TEXT NOT NULL,
    site_name TEXT,
    username TEXT NOT NULL,
    app_password TEXT NOT NULL,
    is_active BOOLEAN DEFAULT 1,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    UNIQUE(user_id, site_url)
);

WordPress Posts Table

CREATE TABLE wordpress_posts (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    user_id TEXT NOT NULL,
    site_id INTEGER NOT NULL,
    wp_post_id INTEGER NOT NULL,
    title TEXT NOT NULL,
    status TEXT DEFAULT 'draft',
    published_at TIMESTAMP,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (site_id) REFERENCES wordpress_sites (id)
);

Usage Examples

Basic Site Connection

from backend.services.integrations import WordPressService

wp_service = WordPressService()
success = wp_service.add_site(
    user_id="user123",
    site_url="https://mysite.com",
    site_name="My Blog",
    username="admin",
    app_password="xxxx-xxxx-xxxx-xxxx"
)

Publishing Content

from backend.services.integrations import WordPressPublisher

publisher = WordPressPublisher()
result = publisher.publish_blog_post(
    user_id="user123",
    site_id=1,
    title="My Blog Post",
    content="<p>This is my blog post content.</p>",
    excerpt="A brief excerpt",
    featured_image_path="/path/to/image.jpg",
    categories=["Technology", "AI"],
    tags=["wordpress", "automation"],
    status="publish"
)

Content Management

from backend.services.integrations import WordPressContentManager

content_manager = WordPressContentManager(
    site_url="https://mysite.com",
    username="admin",
    app_password="xxxx-xxxx-xxxx-xxxx"
)

# Upload media
media = content_manager.upload_media(
    file_path="/path/to/image.jpg",
    alt_text="Description",
    title="Image Title"
)

# Create post
post = content_manager.create_post(
    title="Post Title",
    content="<p>Post content</p>",
    featured_media_id=media['id'],
    status="draft"
)

Authentication

WordPress integration uses Application Passwords for authentication:

  1. Go to WordPress Admin → Users → Profile
  2. Scroll down to "Application Passwords"
  3. Create a new application password
  4. Use the generated password for authentication

Error Handling

All services include comprehensive error handling:

  • Connection validation
  • API response checking
  • Graceful failure handling
  • Detailed logging

Logging

The service uses structured logging with different levels:

  • INFO: Successful operations
  • WARNING: Non-critical issues
  • ERROR: Failed operations

Security

  • Credentials are stored securely in the database
  • Application passwords are used instead of main passwords
  • Connection testing before credential storage
  • Proper authentication for all API calls