BOSSTORQUE · Internal Session Report · Sperry Tree Care Q2 2026

Kit API Fixes & Automation Build

May 5, 2026 · Kit V4 root-cause resolved · kit_send.py hardened · UI automation helper built · Friction log closed at 14 items
1
Root Cause Found
5
Files Built / Updated
14
Friction Items Logged
0
Manual Pastes Required

Kit API Broadcast Content Writes: The Real Problem

Throughout Q2 April sends, broadcast content (subject, body, schedule) could not be written via API. V3 POST/PUT silently returned success but made no changes. Early V4 testing appeared broken too — a 200 response with no effect. This forced Jason to paste every email manually into the Kit UI, a fragile workflow that introduced CSS artifacts if automated and took significant time per send.

Root cause: API key scope, not a broken API. The Kit V4 API writes broadcast content correctly. The older V4 key (kit_528917ec...) lacked write permissions for broadcast content — it returned 200 but silently skipped writes. A new key ("Cowork Send Automation") created with correct scopes resolves it completely.

Resolved
V4 PUT /broadcasts/{id} writes content, subject, and send_at directly

Confirmed: PUT /v4/broadcasts/{id} with {"content": "...", "subject": "...", "send_at": "..."} and header X-Kit-Api-Key: kit_c6d81b86936b3b3c468b674cd1f3295c writes all fields and returns the updated broadcast. Tested against broadcast 23982498 — content (15,372 chars), subject, and schedule all persisted correctly.

What this unlocks

All future Sperry emails can be sent end-to-end via kit_send.py — no manual paste, no Kit UI required for content. Manual paste workflow is retired. V3 remains broken and should never be used for writes.

Files Built & Updated

Hardened
kit_send.py — V4 rewrite with safety preprocessing

Full rewrite from scratch. Now V4-only, with four safety improvements that prevent the most common send errors:

Problem fixedHow
Schedule data loss on PUT (Friction #1)Reads current send_at on every update and re-includes it automatically. Schedule can only be changed via explicit --send-at or cleared via --clear-schedule.
tel: links hard-rejected by Kit (Friction #2)preprocess_html() strips all <a href="tel:..."> anchors before every API call. Phone numbers preserved as plain text. Stripped numbers logged.
No safety gate before live sends--dry-run prints full payload and exits with zero API calls. Required habit before any send.
Key scope confusionInline comment in v4() explains why write-capable key is required. Older keys documented as read-only.
# Full send — content + subject + preserved schedule
python3 kit_send.py \
  --broadcast-id 23982498 \
  --subject "Enter to win + bring a friend" \
  --html-file email_body.html

# Dry run before committing
python3 kit_send.py --broadcast-id 23982498 \
  --subject "Test" --html-file email.html --dry-run

# Content only (schedule auto-preserved)
python3 kit_send.py --broadcast-id 23982498 \
  --content-only --html-file email.html
New
kit_ui_inject.js — Kit editor browser automation helper

Inject into Chrome DevTools or via the Claude Chrome MCP while on any Kit campaign page. Encodes the correct approach for all Kit UI edge cases discovered during Q2 sends — React state handling, modal side effects, datepicker interaction, off-screen inputs.

Exposes three functions that handle the full send workflow when UI access is required (sequences, custom templates, edge cases where API isn't available):

// Paste this file into DevTools console first, then:
await Kit.insertContent(html);               // React-safe, no DOM hacks
await Kit.setSender('michele@sperrytreecare.com'); // Dropdown via native setter
await Kit.setSchedule('2026-05-06T13:00:00Z');  // Unschedule → pencil → picker

Friction items encoded: #4 (React state), #5 (modal side effect), #6 (Unicode corruption), #7 (schedule edit flow), #8 (auto-save), #9 (ref vs coordinate clicks), #12 (scrollIntoView).

New
wp/ — WordPress automation helpers

Two browser-injectable scripts for WordPress issues logged during WS1 and WS4 setup. Parametric — set config variables at the top and run from any WP admin console.

cf7_add_redirect.js
Adds a redirect action to a CF7 form via direct form POST. Bypasses the broken AJAX trigger in the "Add Action" dropdown (Friction #10).
53 lines · run on CF7 edit page
webhooks_add_form.js
Adds a CF7 form ID to an existing WP Webhooks Pro trigger so duplicated forms aren't silently dropped from Zapier flows (Friction #11).
78 lines · run on any WP admin page
Updated
SETUP.md — updated workflow documentation

Rewrote to reflect V4 reality: new flags documented (--dry-run, --clear-schedule, --content-only), send_at preservation behavior explained, HTML preprocessing section added, UI inject and WP helpers referenced with usage examples.

14-Item Log — Final Status

The friction log at sperry-kit-friction-apr2026.jason-8ce.workers.dev was updated twice this session — items 13 and 14 added, summary counts updated, workflow section updated with a green banner pointing to kit_send.py as the preferred path.

#IssueStatus
1PUT clears send_at on scheduled broadcastsFixed in kit_send.py
2tel: links rejected by Kit editorStripped in preprocessor
3Kit API blocked from Claude sandbox (exit 56)kit_send.py runs on Mac via Desktop Commander
4–9Kit UI React / Slate.js / datepicker edge casesEncoded in kit_ui_inject.js
10CF7 Add Action AJAX brokencf7_add_redirect.js built
11WP Webhooks Pro drops duplicated CF7 formswebhooks_add_form.js built
12elementFromPoint fails off-screenscrollIntoView in kit_ui_inject.js
13Kit content API broken (V3 and early V4)Root cause: key scope. Resolved with new key.
14Kit UI schedule / API send_at sync uncertaintyCaution documented — verify with --preview before sends

Automated Rollback

Pre-implementation backups saved to /tmp/friction-rollback/. Restore script is executable and verified — line count checked on restore.

To revert kit_send.py and SETUP.md

bash /tmp/friction-rollback/restore.sh — restores both files, verifies line counts, prints pass/fail per file.

Note: /tmp is cleared on reboot. Copy to a permanent location if rollback window needs to extend past this session.

Remaining Open Items

ItemPriorityNotes
SOW vs. actual status reportHighPending since session start. Covers all 4 workstreams vs. Q2 SOW commitments.
Email 5 (ID 23982498)Sending tomorrowScheduled May 6 6am PDT. Do not touch. Verify Kit UI shows correct schedule before EOD.
WS4 automation buildOverdueKit sequences + Zapier. Paste guide exists. Sequences need content via Kit UI.
Phase Zero designJun 1Deadline Jun 1 2026.
Meta campaignBlockedAwaiting Rob/Michele approval on creative.