PART 03 · PHASE 1 · REVIEWED 31 AUG 2026

Data contracts & safe integrations.

Build a tenant-safe evidence layer before connecting a model. Current OAuth, signed webhooks, minimized data, explicit consent and separate read/write authority replace the earlier “one spine, every agent writes” design.

Architecture reviewSecurityData governance

This is not copy-paste production code. Platform endpoints, versions, scopes, pricing and policies change. Verify the official documentation on the implementation date and obtain qualified security, privacy and legal review. Use development stores/accounts and synthetic fixtures; do not test writes on a live campaign, customer or order.

1. Separate four planes

1
Ingestion — verifies sender, schema, tenant, timestamp and event ID; acknowledges quickly and queues safely.
2
Evidence store — minimized, tenant-isolated, access-controlled facts with provenance, version, retention and deletion.
3
Proposal service — read-only views in; typed, expiring recommendations out. No platform write credential.
4
Executor — deterministic policy, exact human approval, current-state check, cap, idempotency, audit and rollback.

2. A minimal schema—not a customer data lake

Store only what the defined decision needs. Avoid raw webhook bodies and full conversation transcripts by default. Keep contact data out of model context and embeddings. Tokenize identifiers where possible, encrypt sensitive fields, restrict decryption to a narrowly authorized service, and enforce tenant policy server-side on every query.

-- Pseudocode: adapt with a database/security specialist. CREATE TABLE commerce_events ( tenant_id uuid NOT NULL, source text NOT NULL, source_event_id text NOT NULL, event_type text NOT NULL, occurred_at timestamptz NOT NULL, received_at timestamptz NOT NULL, schema_version text NOT NULL, minimized_payload jsonb NOT NULL, expires_at timestamptz NOT NULL, UNIQUE (tenant_id, source, source_event_id) ); CREATE TABLE change_proposals ( id uuid PRIMARY KEY, tenant_id uuid NOT NULL, trace_id text NOT NULL, target_version text NOT NULL, proposed_diff jsonb NOT NULL, evidence_refs text[] NOT NULL, expires_at timestamptz NOT NULL, approval_state text NOT NULL );

3. Platform integration review

Salla

Salla's current Merchant API uses OAuth 2.0, scoped merchant authorization, the https://api.salla.dev/admin/v2 base, expiring access tokens and refresh handling. Subscribe only to necessary webhooks; follow the official verify → acknowledge → queue → process → idempotently process pattern. Never accept a webhook without its documented sender-verification control.

Official Salla get-started guide · OAuth authorization · Webhook security

Zid

The old lesson incorrectly described a static API key. Zid documents a server-side OAuth 2.0 authorization-code flow and store-scoped manager token headers. Keep client secrets and tokens server-side in approved secret storage, request minimum scopes, handle expiry/revocation, and verify the current webhook mechanism for the subscribed event.

Official Zid authorization · Webhook reference

Shopify

Pin a supported Admin GraphQL API version (the reviewed lesson uses 2026-07) and plan upgrades before its support window closes. Use the authorization flow appropriate to the app; client credentials are only for apps and stores in the same Shopify organization. Request protected customer data only when needed and approved. Fulfillment status is not universal proof that COD cash was collected—model payment, fulfillment, delivery and reconciliation as separate facts.

API versioning · Authentication and authorization · Protected customer data

Meta Marketing API and Ad Library

Pin the current Graph API version (reviewed here as v26.0), start with a dedicated read identity, and place write scopes on a separate executor only after app review and pilot approval. Do not assume a token never expires; design rotation, revocation and incident response. Use the public Ad Library as discovery material only—visibility and longevity do not prove spend, targeting, conversion or profitability. Do not replace an official interface with browser scraping unless current terms and counsel explicitly permit the exact use.

Meta Ad Library

TikTok advertising and Creative Center

Verify the current Business/Marketing API product, app review, scopes, endpoints and rate limits in TikTok's official developer materials. Creative Center is an inspiration and trend-discovery surface, not proof of a competitor's business result. Respect usage terms and do not infer causal performance from ranking or visibility.

Official Creative Center overview

WhatsApp Business messaging

Verify the current Cloud API, pricing, customer-service window, template, opt-in and messaging rules; the dollar figures and approval times in the earlier lesson were retired. Validate webhook authenticity exactly as documented, deduplicate message IDs, minimize transcripts, honor opt-out and deletion, and limit replies to approved facts. Payments, refunds, credit, safety, complaints and ambiguity require a trained human.

4. Security and privacy acceptance criteria

OAuth and secrets
No credential in browser, prompt, log or repository
Approved secret manager, per-tenant identities, minimum scopes, expiry monitoring, rotation and rapid revocation.
Tenant isolation
Deny by default
Server-side authorization on every read/write, composite tenant keys, negative cross-tenant tests and audited admin access.
Webhooks
Verified, schema-valid and deduplicated
Preserve raw bytes only as required for verification; reject invalid sender/timestamp/schema; queue; process idempotently; reconcile uncertain outcomes.
Personal data
Necessary, permitted and deletable
Document purpose/lawful basis, minimization, access, retention, region/transfer, subprocessors, data-subject requests and incident contact.
Prompt injection
Content never grants authority
Treat messages, pages, ads and files as untrusted data; isolate instructions; allowlist tools/hosts; keep secrets unavailable; test exfiltration and policy bypass.
External writes
Proposal → approval → deterministic executor
Exact signed diff, current-state recheck, expiry, cap, idempotency, audit, canary, stop control and tested rollback.

5. Test without touching production

A connected API is not a production-ready workflow. Do not add real customer data or write authority until the evidence package, threat model, privacy review, platform review, owner approval, monitoring, incident response and rollback test are complete.

← Part 2 — Service boundariesPart 4 — Public research →