Setting the file. One moment.
Skill 128 · Build Zoom Phone Integration
Subchapter 128.10
examples/smart-embed-postmessage-bridge.mdMarkdown1 KBView on GitHub
References
Call Handling PatternsAlso bundled
Architecture And LifecycleSmart Embed event/control flow is window.postMessage based. Reliability depends on strict initialization order and origin validation.
const ZOOM_ORIGIN = 'https://applications.zoom.us';
const iframe = document.querySelector('#zoom-embeddable-phone-iframe');
function initSmartEmbed(config) {
iframe?.contentWindow?.postMessage({
type: 'zp-init-config',
data: config,
}, ZOOM_ORIGIN);
}
function makeCall(number, callerId) {
iframe?.contentWindow?.postMessage({
type: 'zp-make-call',
data: { number, callerId, autoDial: true },
}, ZOOM_ORIGIN);
}
window.addEventListener('message', (event) => {
if (event.origin !== ZOOM_ORIGIN) return;
const payload = event.data;
if (!payload?.type) return;
switch (payload.type) {
case 'zp-call-ringing-event':
case 'zp-call-connected-event':
case 'zp-call-ended-event':
case 'zp-call-log-completed-event':
handlePhoneEvent(payload);
break;
default:
break;
}
});event.id (if present) for idempotency.