Skip to main content
When you embed a BoostGPT agent directly in an iframe, the chat is saved by BoostGPT after the first message is sent. To resume that same chat after your page reloads, store the active chat_id sent by the iframe.

Embed URL

Start with your agent URL and add embed=1.
After the first message, the embedded agent navigates to:

Listen For Chat IDs

BoostGPT sends a postMessage event whenever an embedded chat id becomes active.
Event payload:

Restore The Chat

When your page loads again, read the saved chat id and include it in the iframe URL.

Full Example

Use a scoped storage key if you embed multiple agents:

SSO With Iframe Embeds

Pass a short-lived SSO token in the iframe URL so the embedded agent can authenticate the user on its own domain.
When restoring a saved chat, include the same parameter on the chat URL:
Generate SIGNED_JWT on your server using the agent’s SSO secret. Do not sign SSO tokens in browser code.
See SSO setup for the full JWT payload and backend examples.