← back to Marketing Command Center
drafts/glitter-sequin-exclusive/connie-create.sh
28 lines
#!/usr/bin/env bash
# Glitter & Sequin — create the REAL draft by posting DIRECTLY to Connie
# (cc-agent, /root/DW-Agents/cc-agent) at 127.0.0.1:9820, which holds the live
# Constant Contact OAuth token. Reads the route schema, then attempts create.
# READ + DRAFT only. Does NOT send/schedule.
set +e
PAYLOAD=/tmp/gs-draft.json
PASS="${CC_PASS:-DWSecure2024!}" # Connie auth (verified 200)
CONNIE=http://127.0.0.1:9820
SRC=/root/DW-Agents/cc-agent
line(){ printf '\n== %s ==\n' "$1"; }
line "connie /api/campaigns/draft handler (expected body fields)"
grep -rnE "campaigns/draft" "$SRC" --include=*.js 2>/dev/null | grep -iE "post|router|app" | head
# show ~35 lines after the route definition so we see req.body destructuring
F=$(grep -rlE "campaigns/draft" "$SRC" --include=*.js 2>/dev/null | head -1)
if [ -n "$F" ]; then
echo "-- source: $F --"
awk '/campaigns\/draft/{p=1} p{print; n++} n>38{exit}' "$F"
fi
line "attempt create: POST $CONNIE/api/campaigns/draft (our {name,subject,from,html})"
curl -s -w '\nHTTP:%{http_code}\n' --max-time 25 -u admin:"$PASS" \
-H 'Content-Type: application/json' -X POST \
"$CONNIE/api/campaigns/draft" --data @"$PAYLOAD"
line "done (nothing sent)"