Implementation Document — Popin Agent Widget
1. Purpose
This document explains how a sample page:
Loads the Popin Agent widget
Initializes it
Opens it via a custom button
Handles widget events
2. Configuration & Secrets
Widget Script URL
Inline <script> before </body>
Set via popIn.setAttribute("src", ...)
Init Identity / PIN
popInAgentWidgetInit("email", "pin")
PIN is obtained from the Popin dashboard
User Context on Open
PopinAgent("open", { name, mobile })
Replace demo PII with real user/session data per policy
3. Implementation Details
3.1 Script Injection
A
<script>element is dynamically createdsrcis set to the Popin Agent scriptScript is appended to
document.bodyInitialization runs on script load
3.2 Launcher UI
A
<button>triggers the widgetOn click,
PopinAgent("open", {...})is called
3.3 Event Callback
window.popinAgentEventreceives events from the widgetExample use case: handle
call_initiatedeventEvent data may contain a joining URL
4. User Flow
User opens the page
Page loads → Popin script is requested
Script loads →
popInAgentWidgetInitruns → widget becomes readyUser clicks
#popin-buttonPopinAgent("open", …)executes → widget opens with user dataWidget emits events →
popinAgentEventhandles them (currently logs to console)
Last updated