execute-action
The `execute-action` command fires campaign audit and campaign launch actions against real APIs via Python's `urllib.request`, reading credentials from environment variables without requiring OAuth flows. Use it to immediately execute read operations, or to fire write operations when both `--execute` and `--confirm` flags are provided; each execution logs to the audit trail. For OAuth-only connectors like Google Ads or Meta Marketing, the command returns a manifest showing the HTTP request shape that Claude's MCP tools would send instead.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/indranilbanerjee/digital-marketing-pro/HEAD/commands/execute-action.md -o ~/.claude/commands/execute-action.mdexecute-action.md
# /digital-marketing-pro:execute-action — Fire an Action Against Real API
Resolves an action via `connector_resolver` and (optionally) executes it via `connector_executor` using stdlib `urllib.request`. No third-party deps, no OAuth flow — credentials read from env vars only.
## Three modes of operation
| Flag combo | What happens |
|------------|-------------|
| no flags | Dry-run: returns the resolved manifest (same as `/digital-marketing-pro:doctor --action <id>`) — no HTTP call |
| `--execute` only | Read ops fire immediately. Write ops are BLOCKED with `execute_blocked_reason`. |
| `--execute --confirm` | Write ops also fire. Execution is logged to `~/.claude-marketing/brands/{brand}/executions/`. |
## Which connectors execute end-to-end via Python
These execute against the real API when the named env var is set (10 actions, 8 connectors):
| Connector | Env var | Auth | Verified endpoint |
|-----------|---------|------|---------------------|
| Slack | `SLACK_BOT_TOKEN` | Bearer xoxb- | `POST chat.postMessage` |
| HubSpot | `HUBSPOT_PRIVATE_APP_TOKEN` | Bearer | `GET /automation/v4/flows`, `POST /marketing/v3/campaigns` |
| Klaviyo | `KLAVIYO_PRIVATE_KEY` | `Klaviyo-API-Key`, revision 2026-04-15 | `GET /api/flows`, `PATCH /api/flows/{id}` (vnd.api+json) |
| SendGrid | `SENDGRID_API_KEY` | Bearer SG. | `POST /v3/mail/send` (202) |
| Brevo | `BREVO_API_KEY` | `api-key:` header (NOT Bearer) | `POST /v3/smtp/email` |
| Customer.io | `CUSTOMERIO_APP_API_KEY` | Bearer (App API key, not Site/Track) | `POST /v1/send/email` |
| Mailchimp | `MAILCHIMP_API_KEY` | Basic auth, dc from key suffix | `GET /3.0/automations` |
| Ahrefs | `AHREFS_API_KEY` | Bearer | `GET /v3/site-explorer/metrics` |
## Which connectors REQUIRE the MCP path (cannot execute from Python)
OAuth-only connectors return `execute_blocked_reason: "use MCP path"`. Use Claude with the connector's MCP installed instead:
Google Ads, Meta Marketing, LinkedIn Marketing, LinkedIn Publishing, TikTok Ads, Twitter/X (OAuth 1.0a), Gmail, Google Calendar, Google Analytics, Google Search Console, Meta Graph (organic), Salesforce, Pipedrive, Zoho CRM, Buffer, Hootsuite, Cision, Muckrack, Amplitude, Similarweb, SEMrush, Moz, Intercom, Canva, Figma.
For all of these, the **`manifest_ready`** response includes the exact HTTP request shape Claude's MCP tool will send — so even though Python can't fire it directly, you can see what would go out.
## Quick examples
```
# Dry-run: see the manifest for HubSpot list-workflows
/digital-marketing-pro:execute-action --action audit-workflows --brand acme
# Read op: fire HubSpot list-workflows (read-only, no --confirm needed)
HUBSPOT_PRIVATE_APP_TOKEN=pat-na1-xxx \
/digital-marketing-pro:execute-action --action audit-workflows --brand acme --execute
# Write op: post Slack kickoff message (requires --confirm)
SLACK_BOT_TOKEN=xoxb-xxx \
/digital-marketing-pro:execute-action --action internal-kickoff --brand acme \
--data '{"plan": {"slack_channel": "#launches", "kickoff_message": "Launch day!"}}' \
--execute --confirm
# Write op without --confirm: BLOCKED
/digital-marketing-pro:execute-action --action create-campaign --brand acme --execute
# -> execute_blocked_reason: "action create-campaign is a write op; --confirm flag is required"
```
## Safety gates summary
1. **No --execute** -> no HTTP call ever fires
2. **Write op without --confirm** -> blocked with reason
3. **OAuth-only connector** -> blocked with alternative pointing to MCP path
4. **Missing env var** -> blocked with `setup_hint_credential` naming the var
5. **Unconfigured connector** -> blocked at resolver level (mode=stub_unconfigured)
6. **Unresolved placeholder** -> request NEVER sent (would have leaked literal `{VAR}` text)
7. **Every fired call** -> logged to `~/.claude-marketing/brands/{brand}/executions/exec-{connector}-{action}-{ts}.json`
## See also
- [scripts/connector_executor.py](../scripts/connector_executor.py) — the underlying executor
- [scripts/connector_resolver.py](../scripts/connector_resolver.py) — the resolver
- [scripts/action-doctor.py](../scripts/action-doctor.py) — readiness diagnostic (no execution)
- [/digital-marketing-pro:doctor](doctor.md) — per-action readiness map
## Run
```bash
python "${CLAUDE_PLUGIN_ROOT}/scripts/connector_executor.py" "$@"
```Design a statistically rigorous A/B or multivariate test plan — If/Then/Because hypothesis, control and variant specs, required sample size per variant (absolute vs relative MDE via sample-size-calculator.py), test duration, guardrail metrics, stopping rules, and go/no-go decision criteria. Triggers on \"/digital-marketing-pro:ab-test-plan\", \"set up an A/B test\", \"how long should my test run\", \"calculate sample size for an experiment\", \"is this test result significant\". Reads the brand profile and past campaign-tracker results to avoid re-testing validated hypotheses; finished tests are evaluated with significance-tester.py by the cro-specialist agent.
Generate 3-5 ad copy variations per platform — headlines, descriptions, and CTAs formatted to Google, Meta, LinkedIn, TikTok, X, and Pinterest specs — each scored 1-10 with policy-compliance flags, A/B testing groupings, and a message-match check against the landing page. Triggers on \"/digital-marketing-pro:ad-creative\", \"write ad copy for Meta\", \"give me RSA headline variations\", \"we need LinkedIn ad copy\", \"draft TikTok ad creative\". Reads the brand profile, guidelines, and compliance rules; routes video ad scripts to /digital-marketing-pro:video-script and gates AI-generated visuals for EU campaigns through /digital-marketing-pro:c2pa-metadata and /digital-marketing-pro:check.
Walk through adding a custom MCP server integration to the plugin — searches npm for an existing MCP package (or scaffolds a custom server from the plugin's guide), generates the exact .mcp.json entry, sets up environment-variable credentials, tests connectivity, and documents the tools the new server exposes. Triggers on \"/digital-marketing-pro:add-integration\", \"connect Ahrefs to the plugin\", \"add a new MCP server\", \"integrate our internal API\", \"hook up Stripe data\". Reads the brand profile and agency credential profiles at ~/.claude-marketing/credentials/ to map client-specific keys; custom builds follow skills/context-engine/custom-mcp-guide.md.
Audit how a brand appears across the 6 canonical AI answer surfaces — ChatGPT, Perplexity, Google AI Mode, AI Overviews, Gemini, Copilot — probing 10-25 queries into a numbered output bundle with per-platform visibility scorecards, citation-accuracy checks, a competitor matrix, content gaps, and an optimization playbook behind a four-gate quality scorecard. Triggers on \"/digital-marketing-pro:aeo-audit\", \"does ChatGPT know about our brand\", \"check our AI search visibility\", \"how does Perplexity describe us\", \"are we showing up in AI Overviews\". Reads the brand profile; reconciles probes against GSC actuals via /digital-marketing-pro:gsc-ai-performance and defines the AI-visibility scoring standard reused by geo-monitor and share-of-voice.
Strategy module for Answer Engine / Generative Engine Optimization — audits AI visibility, restructures content for citation, runs entity-consistency checks across Knowledge Graph, Wikidata, Wikipedia, Crunchbase, and LinkedIn, and produces JSON-LD schema specs, monitoring frameworks, and a 90-day LLM content strategy. Triggers on \"/digital-marketing-pro:aeo-geo\", \"how do we get cited by AI\", \"optimize for AI Overviews\", \"fix our entity consistency\", \"do we need llms.txt\". Reads the brand profile, compliance rules, and industry benchmarks; its measurement counterpart is /digital-marketing-pro:aeo-audit, with GSC actuals via /digital-marketing-pro:gsc-ai-performance.
Generate a portfolio-level dashboard across ALL client brands — per-client RAG health scores, campaign activity, budget pacing, aggregate KPIs, team utilization, pending approvals, upcoming deadlines, and an alerts panel — built for agency standups and weekly reviews. Triggers on \"/digital-marketing-pro:agency-dashboard\", \"how are all our clients doing\", \"portfolio health check\", \"budget pacing across accounts\", \"which accounts are at risk\". Enumerates every brand under ~/.claude-marketing/brands/ and pulls data via campaign-tracker.py, execution-tracker.py, and team-manager.py; drill into a single client with /digital-marketing-pro:performance-report or /digital-marketing-pro:client-report.
Invoke when the user needs to manage multiple client brands, view portfolio-level dashboards, generate client reports, manage SOPs, switch credential profiles, assign team tasks, configure regions, or generate executive summaries. Triggers on requests involving multi-client management, agency workflows, client onboarding, or portfolio oversight.
Invoke when the user needs help with marketing measurement, KPI definition, dashboard design, attribution reporting, performance analysis, competitive benchmarking, or translating data into marketing decisions. Triggers on requests involving metrics, reporting, analytics setup, or data interpretation.