Skip to content

How the iframe works

The Flume iframe is a page Flume hosts and you frame. It runs the whole flow: verify the user, search by photo, get an instant quote, save. Your backend starts it. Your page listens to it.

ActorResponsibility
Your backendStarts a session. Exchanges the connect code. Stores the user access token. Holds the partner key
Your pageFrames the iframe. Checks and handles its messages. Writes the saved item
Flume iframeDraws every screen. Calls the Flume API with its own short-lived credential
Flume APIVerifies users, searches, prices, builds the save payload

Your partner key and the user access token never reach the browser.

The whole flow, from a click to a saved itemOne open of the iframe, end to end. Lighter steps happen only the first time a user opens it. The same content is listed as text under the diagram.Flume iframeYour pageYour backendFlume servers1open item2POST /start-iframe-session3iframe_url, session_uuid4iframe_url, session_uuid5iframe.src = iframe_url6flume:iframe_ready7flume:user_connected8connect_code9POST /users/exchange-connect-code10flume:save_item11flume:item_saved12flume:close_iframeServer call (HTTPS)postMessageAny other stepLighter: not every time

The whole flow, from a click to a saved item. One open of the iframe, end to end. Lighter steps happen only the first time a user opens it.

Read this diagram as text
  1. The user clicks your button. Your page asks your backend to start a session.
  2. Your backend calls POST /start-iframe-session with the user, project and item.
  3. Flume returns iframe_url and session_uuid.
  4. Your backend passes both to your page.
  5. Your page starts the ready timer, adds the message listener, then sets the iframe src.
  6. The iframe posts flume:iframe_ready. Your page clears the timer.
  7. First time only: the user verifies their email, and the iframe posts flume:user_connected with a connect code.
  8. First time only: your page sends the connect code to your backend.
  9. First time only: your backend exchanges the code for the user access token and stores it.
  10. The user saves a product. The iframe posts flume:save_item with the save payload.
  11. Your page writes its record and replies flume:item_saved, or flume:item_save_failed.
  12. The iframe posts flume:close_iframe. Your page removes the iframe.

An iframe session is one user working on one item of one project. Your backend starts it with POST /start-iframe-session. Flume keeps its state on the server.

You sendRequired fieldsPurpose
userexternal_ref, emailWho is working
projectexternal_refWhere the result is filed in the user's Flume account
itemexternal_idWhat the user wants a product for
host_originYesThe exact origin of the page that frames the iframe
You get backUse
session_uuidThe session's id. Filter messages by it. Log it
iframe_urlSet it as the iframe src at once. It holds the launch code

The launch code works once, for 120 seconds. Never store, rebuild or reuse iframe_url.

Flume reuses a session when the user, the project and the item are the same.

  • The item is the same when its external_id, name, item_type, labels, photo links and room names are unchanged.
  • A change to one of those starts a new session.
  • Quantity, unit, ZIP code and unit price are not compared.

A reopened session restores the first of these that exists:

  1. A save that is still waiting for your page's reply.
  2. The instant quote.
  3. The search, at its last step.
  4. The category detection.
EventWhat happens
The user closes the iframeThe session stays. A reopen resumes it
12 hours pass since the session's first openThe iframe posts flume:close_iframe with reason expired. Start a session again
You revoke the user's access tokenThe session ends at its next call
The user's access token is replacedThe session ends at its next call
30 days pass with no useThe session is dropped. The next open starts fresh
  • Reopening the same item does not restart the 12 hours.
  • Inside those hours the iframe renews its own credential. You do nothing.
PieceWhere
A call to start a sessionBackend
A call to exchange a connect codeBackend
A handler that writes a saved itemBackend or page
The iframe tag and the host snippetPage

The full example has all four in three small files.

What you store, and what you never storeTwo things are worth keeping. Everything else is used once and dropped. The same content is listed as text under the diagram.Store, on your serverUse once, never storeExchange responsePOST /users/exchange-connect-codeflume:save_itemthe save payloadSession responsePOST /start-iframe-sessionflume:user_connectedUser access tokenper external_ref, encryptedYour saved itemkeyed by save_uuid: your fields,photo bytes, product_url, two idsiframe_urlset as the iframe src at onceconnect_codeexchange at onceaccess_tokenmapped fieldsuse onceuse once

What you store, and what you never store. Two things are worth keeping. Everything else is used once and dropped.

Read this diagram as text
  1. From the exchange response, store the user access token, per external_ref, encrypted, on your server.
  2. From flume:save_item, store your own record keyed by save_uuid: the fields you map, the photo bytes, product_url, and the two ids an Open in Flume link needs (match.search_session_uuid and product.sku_uuid).
  3. Never store iframe_url or its launch code. Set it as the iframe src at once.
  4. Never store a connect code. Exchange it at once.
  5. Also never store image links or an Open in Flume link: both expire. Log session_uuid with your item id and user id.
WhatWhy
The user access token, per user, on your serverSend it on the next open so the user skips the email step
A stable external_ref per userFlume finds the user's earlier work by it
A stable project.external_ref and item.external_idA reopen of the same item resumes where the user was
session_uuid, with your item id and user idFlume support asks for it
save_uuid with your own recordSo a retried save writes nothing twice
The mapped payload and copies of the image bytesImage links expire
product_urlThe durable link back to the product in Flume
  • It does not resize itself. You size the element. See Set up your page.
  • It does not send an error message. See Timeouts and expiry for how failures show.
  • It does not navigate your page. The iframe tag grants no top navigation.
  • It does not call your backend. All it sends you are the messages.
  • It has no theming options you can set from your page.
  • There is no npm package for the host snippet. Copy the file from Set up your page.