Skip to content
prod 352bb92
Browse

Wiring vendor consoles with an AI agent

Use this guide when a CodeCanyon playbook sends you into Discord, Slack, MonSpark, Stripe, Cloudflare, Sentry, Google Analytics, or another provider dashboard. Browser automation can do a lot of the careful clicking and verification, but it must never take over login, account creation, payment authorization, password entry, or secret disclosure.

The pattern is simple: the operator supplies the logged-in browser and performs secret/auth moments; the agent drives the non-secret UI flow, captures evidence, and verifies the result.

flowchart LR
A["Operator logs in<br/>and authorizes provider"] --> B["Agent navigates by<br/>accessibility tree"]
B --> C["Provider creates<br/>URL / monitor / setting"]
C --> D["Operator copies secret<br/>to OS clipboard"]
D --> E["Agent moves value<br/>clipboard → stdin → runtime file"]
E --> F["Agent runs liveness test<br/>without printing token"]
WorkOwnerRule
Provider login, SSO, MFA, paid plan, account creation👤 HumanStop and let the operator complete it.
Password, token, webhook, API key, card, legal acceptance👤 HumanThe agent never types, reads, logs, screenshots, or repeats it.
Navigation, non-secret fields, save buttons, monitor names, intervals🤖 AgentDrive with browser automation when available.
Verification, screenshots, liveness probes, logs🤖 AgentUse evidence, not “looks fine.”

Screenshots and browser viewports can disagree. A screenshot may come back at one pixel width while the real browser viewport is wider, so coordinate clicks miss the target. Prefer the browser accessibility tree and click by element reference, role, name, or stable selector.

Bad pattern:

Click at x=1549,y=420 because the screenshot showed the button there.

Good pattern:

Read the page/accessibility tree → find button named "Create Webhook" → click that element ref.

Provider settings modals often render late. After Save, do not trust a single screenshot. Verify by reading page text, the tab title, the modal state, or the created object row. If the modal still shows stale content, wait, re-read, then verify the durable state.

Some dashboards require a detour before the intended tab becomes clickable. In Discord, for example, an Integrations tab may not activate until the agent clicks Permissions and then Integrations. This is not failure; it is a UI quirk. Read the page after each click and continue from observed state.

The safe bridge for provider-generated URLs is:

  1. 👤 Human clicks the provider’s Copy URL / Copy secret button.
  2. 🤖 Agent reads the local OS clipboard with pbpaste.
  3. 🤖 Agent pipes the value over SSH stdin into the runtime file.
  4. 🤖 Agent unsets variables and verifies without printing the secret.

Example pattern for an Admin-Server webhook or heartbeat URL:

Terminal window
SSH_ALIAS="<server-alias-from-Zaj-PROJECT>"
SERVER_ENV_FILE="~/Admin-Server/config/server.env"
VAR_NAME="DISCORD_WEBHOOK_OPS"
pbpaste | ssh "$SSH_ALIAS" "umask 077; tmp=\$(mktemp); cat > \"\$tmp\"; python3 - \"\$tmp\" '$SERVER_ENV_FILE' '$VAR_NAME' <<'PY'
import pathlib, sys
value_path, env_path, key = sys.argv[1:]
value = pathlib.Path(value_path).read_text().strip()
env = pathlib.Path(env_path).expanduser()
lines = env.read_text().splitlines() if env.exists() else []
prefix = key + '='
rendered = f'{key}=\"{value}\"'
changed = False
for i, line in enumerate(lines):
if line.startswith(prefix):
lines[i] = rendered
changed = True
break
if not changed:
lines.append(rendered)
env.write_text('\\n'.join(lines) + '\\n')
PY
rm -f \"\$tmp\"
chmod 600 $SERVER_ENV_FILE"
# Expected: secret travels clipboard → stdin → server.env; it is never printed in chat, logs, or argv.

Do not use echo "$SECRET", paste live URLs into chat, or pass secrets as command-line arguments. Command arguments can appear in process lists; stdin does not.

Run a harmless liveness test before trusting a copied URL:

ProviderTestExpected
Discord webhookcurl -fsS -o /dev/null -w '%{http_code}\n' "$DISCORD_URL"200 for valid metadata, 401 means revoked or malformed
Slack Incoming Webhookprintf '{"text":"smoke test"}' | curl -fsS -X POST -H 'Content-type: application/json' --data @- "$SLACK_URL"ok
MonSpark heartbeatcurl -fsS -o /dev/null -w '%{http_code}\n' "$HEARTBEAT_URL"200 or provider-success response

Unset each variable after the test. If a provider cannot be safely probed without sending a message, skip the preflight and run the documented end-to-end smoke test after wiring.

Use one webhook per destination channel. Common mapping: ops alerts → #server-alerts, app errors → #app-alerts, deploy notices → #deployments.

  1. Open the Discord workspace.
  2. Right-click the target channel.
  3. Click Edit Channel.
  4. Open Integrations. If the tab does not activate, click Permissions, then Integrations again.
  5. Click Create Webhook.
  6. Rename it for the server/app/environment.
  7. Click Save.
  8. Click Copy URL.
  9. Use the clipboard bridge to store it in 1Password and ~/Admin-Server/config/server.env.
  1. Open https://api.slack.com/apps.
  2. Select the Slack app for the workspace, or create one if the human has approved that app.
  3. Open Incoming Webhooks.
  4. Click Add to Workspace.
  5. Choose the destination channel.
  6. Click Copy on the generated webhook URL.
  7. Use the clipboard bridge to store it in 1Password and the runtime config.
  1. Open MonSpark.
  2. Choose Cron Job.
  3. Click Create Monitor.
  4. Set the monitor name, expected interval, and grace window.
  5. Save the monitor.
  6. Click Copy heartbeat URL.
  7. Use the clipboard bridge to populate HEARTBEAT_SNAPSHOT, HEARTBEAT_INTEGRITY, HEARTBEAT_RESOURCE, HEARTBEAT_ERRORLOG, HEARTBEAT_INVENTORY, or app-level MONSPARK_CRON_URL.
  • Human logged into the provider dashboard; agent did not handle credentials or MFA.
  • Agent clicked by accessibility tree / element ref, not screenshot coordinates.
  • Modal/tab state was verified by page text or object row after save.
  • Secrets moved through clipboard → stdin → runtime config; no live value printed.
  • Provider URL passed the relevant liveness test or documented end-to-end smoke test.
  • Zaj-PROJECT.md records the non-secret workspace/provider name and vault pointer.