MCPAsk Claude, ChatGPT or Cursor about any client:Setup guideSetup →

Publishing & Webhooks

Ship Loop

Ship approved SiteChange updates directly to WordPress or any custom site (Next.js, Astro, custom CMS). When a change publishes live, Foxcite automatically marks it shipped and begins the Experiment measurement schedule.

WordPress (No Plugin Required)

Connect any HTTPS WordPress site in Brand Settings → Publishing using a native WordPress Application Password (Users → Profile → Application Passwords). Credentials are encrypted at rest with Fernet and never logged.

  • Creates new posts/pages or updates existing pages matched by slug or wp_post_id.
  • Defaults to draft so you can review first, or set publish to go live and auto-start Experiment readings.
  • Every edit creates a native WordPress revision — call POST /changes/{id}/revert to roll back in one click.

Custom Webhook / Next.js

For Next.js, Astro, or custom backends, connect an HTTPS webhook endpoint in Brand Settings → Publishing. Foxcite auto-generates a whsec_... signing secret (shown once) and signs every delivery with HMAC-SHA256 over {timestamp}.{raw_body}.

Delivery Payload

{
  "event": "site_change.publish",
  "brand_id": "b1a2c3d4-...",
  "change_id": "9f8e7d6c-...",
  "kind": "new_page",
  "title": "Emergency AC Repair in Tampa: 24/7 Pricing Guide",
  "slug": "emergency-ac-repair-tampa",
  "target_url": "https://acmehvac.com/blog/emergency-ac-repair-tampa",
  "summary": "Add transparent pricing table and FAQ section",
  "content_markdown": "## Pricing\nFlat $89 diagnostic...",
  "content_html": "<h2>Pricing</h2>\n<p>Flat $89 diagnostic...</p>",
  "status": "publish",
  "timestamp": "2026-11-28T19:00:00"
}

Next.js Route Handler Example

// app/api/foxcite/route.ts
import crypto from 'crypto';
import { NextResponse } from 'next/server';
import { revalidatePath } from 'next/cache';

function verifySignature(secret: string, timestamp: string, rawBody: string, headerSig: string) {
  const expected =
    'sha256=' +
    crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
  const a = Buffer.from(expected);
  const b = Buffer.from(headerSig);
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

export async function POST(req: Request) {
  const rawBody = await req.text();
  const timestamp = req.headers.get('x-foxcite-timestamp') ?? '';
  const signature = req.headers.get('x-foxcite-signature') ?? '';
  const event = req.headers.get('x-foxcite-event') ?? '';

  // Reject stale or tampered requests (5-minute replay window)
  const ageSeconds = Math.abs(Math.floor(Date.now() / 1000) - Number(timestamp));
  if (!timestamp || ageSeconds > 300 || !verifySignature(process.env.FOXCITE_WEBHOOK_SECRET!, timestamp, rawBody, signature)) {
    return NextResponse.json({ error: 'Invalid signature' }, { status: 401 });
  }

  const payload = JSON.parse(rawBody);
  if (event === 'ping') {
    return NextResponse.json({ ok: true });
  }

  if (event === 'site_change.publish') {
    // Save payload.title, payload.slug, payload.content_markdown / payload.content_html to your CMS or DB
    // const record = await db.posts.upsert({ ... });
    revalidatePath('/blog');
    revalidatePath(`/blog/${payload.slug}`);

    return NextResponse.json({
      url: `https://yourdomain.com/blog/${payload.slug}`,
      ship_ref: `cms:${payload.slug}`,
    });
  }

  return NextResponse.json({ ok: true });
}

REST Endpoints

MethodPathBehavior
GET/brands/{brand_id}/publishersList configured publishing connectors for a brand (secrets are never returned).
PUT/brands/{brand_id}/publishers/{provider}Connect or update wordpress or webhook. Auto-generates a signing_secret once on first webhook save.
POST/brands/{brand_id}/publishers/{provider}/testVerify WordPress credentials (/wp-json/wp/v2/users/me) or send a signed ping event to your webhook.
DELETE/brands/{brand_id}/publishers/{provider}Disconnect the publisher and wipe its encrypted secret.
POST/changes/{change_id}/publishPublish a SiteChange to WordPress or your webhook. When status is "publish", auto-marks the change shipped so linked Experiments begin measuring.
POST/changes/{change_id}/revertRestore a published WordPress change to its previous revision (or trash a newly created post).