agentleFS
thunderphonethunderphone/skills/embed-web-widget/SKILL.md

embed-web-widget

Skill0 starsChanged 57 days agoMITView on GitHub

Add, configure, style, or debug the ThunderPhone web voice widget. Use when someone asks about @thunderphone/widget, ThunderPhoneWidget, useThunderPhone, the CDN script, pk_live_ publishable keys, allowed domains, widget sessions, React integration, or a headless call UI.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Choose the surface: Use the React component for the quickest product UI, useThunderPhone for a custom React experience, or the CDN build …

    line 18
  2. Very specific:

    Install the React package: Run npm install @thunderphone/widget, import its stylesheet, and render the component.

    line 31
  3. Distinctive:

    Or mount the CDN build: Use the documented latest path while prototyping.

    line 43
  4. Very specific:

    Use headless mode for custom UI: Keep call initiation behind a clear user gesture, show connecting/connected/error state, expose mute and …

    line 58
  5. Distinctive:

    Verify: Test an allowed and disallowed domain, microphone allow/deny, connect, mute, interrupt, end, reconnect, mobile layout, keyboard …

    line 64
  6. Distinctive:

    Start with the widget overview, React component, and headless hook.

    line 102
  7. Distinctive:

    Never expose an organization API key or silently start microphone capture.

    line 104
  8. Very specific:

    Treat context as caller-visible conversation data, not a secret channel.

    line 105

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Embed the web widget

  1. Create a publishable key. In Web Widgets, choose the deployed agent and allow only the intended production and development domains. A pk_live_ key is designed for browsers; an sk_live_ organization key is not. Publishable keys are available through POST /v1/publishable-key when an authorized backend manages them.
  2. Choose the surface. Use the React component for the quickest product UI, useThunderPhone for a custom React experience, or the CDN build for a framework-free page.
{
  "name": "Marketing site",
  "mode": "agent",
  "agent_id": 12,
  "allowed_domains": ["example.com"]
}
  1. Install the React package. Run npm install @thunderphone/widget, import its stylesheet, and render the component.
import { ThunderPhoneWidget } from "@thunderphone/widget";
import "@thunderphone/widget/style.css";

export function VoiceWidget() {
  return <ThunderPhoneWidget publishableKey={import.meta.env.VITE_THUNDERPHONE_PUBLISHABLE_KEY} />;
}
  1. Or mount the CDN build. Use the documented latest path while prototyping; pin a tested version for controlled releases.
<div id="thunderphone"></div>
<link rel="stylesheet" href="https://cdn.thunderphone.com/widget/latest/style.css" />
<script src="https://cdn.thunderphone.com/widget/latest/widget.js"></script>
<script>
  ThunderPhone.mount({
    element: '#thunderphone',
    publishableKey: window.THUNDERPHONE_PUBLISHABLE_KEY,
  });
</script>
  1. Use headless mode for custom UI. Keep call initiation behind a clear user gesture, show connecting/connected/error state, expose mute and end controls, and clean up the session on unmount.
  2. Create sessions only through the widget flow. The browser exchanges the publishable key at POST /v1/widget/session; never send an organization API key to the browser. The SDK handles this exchange.
  3. Verify. Test an allowed and disallowed domain, microphone allow/deny, connect, mute, interrupt, end, reconnect, mobile layout, keyboard operation, and the deployed agent's behavior. Confirm widget calls appear in call logs.

API-key management example for an authorized backend:

curl --fail-with-body https://api.thunderphone.com/v1/publishable-key \
  -H "Authorization: Bearer $THUNDERPHONE_API_KEY" \
  -H "X-ThunderPhone-Client: skills/embed-web-widget@1.0"
import os, requests
r = requests.get("https://api.thunderphone.com/v1/publishable-key",
    headers={"Authorization": f"Bearer {os.environ['THUNDERPHONE_API_KEY']}",
             "X-ThunderPhone-Client": "skills/embed-web-widget@1.0"}, timeout=30)
r.raise_for_status(); print(r.json())
const r = await fetch("https://api.thunderphone.com/v1/publishable-key", { headers: {
  Authorization: `Bearer ${process.env.THUNDERPHONE_API_KEY}`,
  "X-ThunderPhone-Client": "skills/embed-web-widget@1.0" } });
if (!r.ok) throw new Error(await r.text()); console.log(await r.json());

Errors

SymptomCauseFix
Widget rejects the siteCurrent origin is not allowlistedAdd the exact approved origin; do not use an unrestricted wildcard.
Microphone never startsBrowser permission or secure-context requirement failedUse HTTPS or localhost and handle the denied state visibly.
Browser contains sk_live_Server credential was bundled into frontend codeRevoke it, remove it from artifacts, and use a domain-scoped publishable key.
UI connects to old behaviorPublishable key targets another agent or draft is undeployedRead widget configuration and deploy the intended agent revision.

Source and safety rules

See references/widget-options.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.