For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Item
Location in Code
Notes

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 created

  • src is set to the Popin Agent script

  • Script is appended to document.body

  • Initialization runs on script load


3.2 Launcher UI

  • A <button> triggers the widget

  • On click, PopinAgent("open", {...}) is called


3.3 Event Callback

  • window.popinAgentEvent receives events from the widget

  • Example use case: handle call_initiated event

  • Event data may contain a joining URL


4. User Flow

  1. User opens the page

  2. Page loads → Popin script is requested

  3. Script loads → popInAgentWidgetInit runs → widget becomes ready

  4. User clicks #popin-button

  5. PopinAgent("open", …) executes → widget opens with user data

  6. Widget emits events → popinAgentEvent handles them (currently logs to console)

Last updated