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
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- add-knowledgeSkill
- build-tool-integrationSkill
- create-agentSkill
- get-phone-numberSkill
- handle-inbound-callsSkill
- iterate-on-agentSkill
- migrate-from-blandSkill
- migrate-from-elevenlabsSkill
- migrate-from-retellSkill
- migrate-from-vapiSkill
- place-outbound-callsSkill
- run-campaignSkill
- setup-api-keySkill
- setup-webhooksSkill
- test-agentSkill
- thunderphone-mcp-setupSkill
- thunderphone-prompt-builderSkill
- use-with-livekitSkill
- use-with-openai-realtimeSkill
- use-with-pipecatSkill
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
- Very specific: line 18
Choose the surface: Use the React component for the quickest product UI, useThunderPhone for a custom React experience, or the CDN build …
- Very specific: line 31
Install the React package: Run npm install @thunderphone/widget, import its stylesheet, and render the component.
- Distinctive: line 43
Or mount the CDN build: Use the documented latest path while prototyping.
- Very specific: line 58
Use headless mode for custom UI: Keep call initiation behind a clear user gesture, show connecting/connected/error state, expose mute and …
- Distinctive: line 64
Verify: Test an allowed and disallowed domain, microphone allow/deny, connect, mute, interrupt, end, reconnect, mobile layout, keyboard …
- Distinctive: line 102
Start with the widget overview, React component, and headless hook.
- Distinctive: line 104
Never expose an organization API key or silently start microphone capture.
- Very specific: line 105
Treat context as caller-visible conversation data, not a secret channel.
≈ “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.
Files
Embed the web widget
- 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; ansk_live_organization key is not. Publishable keys are available throughPOST /v1/publishable-keywhen an authorized backend manages them. - Choose the surface. Use the React component for the quickest product UI,
useThunderPhonefor 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"]
}- 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} />;
}- 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>- 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.
- 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. - 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
| Symptom | Cause | Fix |
| Widget rejects the site | Current origin is not allowlisted | Add the exact approved origin; do not use an unrestricted wildcard. |
| Microphone never starts | Browser permission or secure-context requirement failed | Use HTTPS or localhost and handle the denied state visibly. |
Browser contains sk_live_ | Server credential was bundled into frontend code | Revoke it, remove it from artifacts, and use a domain-scoped publishable key. |
| UI connects to old behavior | Publishable key targets another agent or draft is undeployed | Read widget configuration and deploy the intended agent revision. |
Source and safety rules
- Start with the widget overview, React component, and headless hook.
- For script tags, use the CDN guide.
- Never expose an organization API key or silently start microphone capture.
- Treat
contextas caller-visible conversation data, not a secret channel.
See references/widget-options.md.
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
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.

