Embed widget — door.js¶
door.js is a small, dependency-free script that turns any web page into one of
a team's front doors. Paste one <script> tag and a chat widget appears;
visitors talk to the team's front-door colleague without an AIR account. There
is no SDK, no server and no build step — unless you want the door to know who
your visitors are, which needs a few lines on your server.
The door itself is opened in AIR by whoever administers the team — see opening a front door. They register the address your page is served from, and give you the snippet.
The snippet¶
<script async src="https://<door-host>/door.js"
data-door="<team-slug>"
data-door-host="https://<door-host>"></script>
<!-- optional: where to put it. Without this, the widget sits bottom-right. -->
<div data-air-door></div>
Copy the exact snippet from the door's card in AIR (the snippet → view & copy); it has the right host and team filled in.
The door decides which team a visitor reaches from the page's browser origin, which must be one of the addresses registered on the door (or one of its testing addresses). Calls from anywhere else are refused — so if the widget loads but never connects, check the page's address matches exactly.
A team without a website of its own can use the door's hosted page instead, which needs no snippet at all.
Telling the door who is visiting¶
By default every visitor is anonymous. An anonymous visitor can chat, be greeted, and use the jobs the team offers at its door; anything that would read a particular person's records or the organisation's internals is refused for them, because nobody has said who they are.
If your visitors are signed in to your site and you want the colleague to know them — their name, what they said last time, their records — your server signs their email with the door's identity secret, and the page carries the signature. The door believes the email only if the signature checks out.
Changed on 13 October 2026
Before this date the door believed any email a page sent, without proof — so anyone could claim to be anyone. An integration that still sends an unsigned email now gets an anonymous session. Mint a secret and sign, as below, to keep recognising your visitors.
1. Get the secret¶
In AIR, on the web door's card, the who's visiting row: mint secret. It is shown once. Put it in your server's configuration — a secret manager, or an environment variable on the server.
Never put it in the page, in client-side JavaScript, or in a repository. rotate replaces it at once (visitors signed with the old one are anonymous until your server signs with the new one); remove makes every visitor anonymous.
2. Sign on your server, each time you render the page¶
message = "air-door-identity.v1\n" + email + "\n" + expires
signature = lowercase hex of HMAC-SHA256(key = secret, data = message)
email— the visitor's email, exactly as you will send it, with no newlines.expires— Unix time in seconds, in the future and no more than 24 hours ahead. A few hours is plenty.
Python:
import hashlib, hmac, time
def sign_door_identity(secret: str, email: str, ttl: int = 3600) -> dict:
expires = int(time.time()) + ttl
message = f"air-door-identity.v1\n{email}\n{expires}".encode()
signature = hmac.new(secret.encode(), message, hashlib.sha256).hexdigest()
return {"email": email, "expires": expires, "signature": signature}
Node:
const crypto = require("crypto");
function signDoorIdentity(secret, email, ttl = 3600) {
const expires = Math.floor(Date.now() / 1000) + ttl;
const signature = crypto
.createHmac("sha256", secret)
.update(`air-door-identity.v1\n${email}\n${expires}`)
.digest("hex");
return { email, expires, signature };
}
3. Put it on the script tag¶
<script async src="https://<door-host>/door.js"
data-door="<team-slug>"
data-participant-ref="ada@example.com"
data-participant-expires="1760400000"
data-participant-signature="9f2c…"
data-display-name="Ada"></script>
data-display-name is cosmetic — how the colleague greets them — and proves
nothing.
If you open sessions yourself rather than using door.js, send the same values
as participant_ref, participant_expires and participant_signature in the
JSON body of POST /door/sessions.
What the door does with it¶
| You send | The session |
|---|---|
| nothing | anonymous |
| an email with a valid, unexpired signature | verified as that person — joined up with their history with the colleague and their records |
| an email with no signature | anonymous — the email is ignored |
| a wrong, tampered, expired or more-than-24-hours signature | anonymous |
| a signature, but the door has no secret | anonymous |
A session is never refused because of a bad identity; it opens anonymous. The
session response says which happened: identity is verified or
anonymous, and identity_refused names why a supplied email did not count —
unsigned, bad_signature, expired, expiry_too_far,
door_has_no_identity_secret, not_an_email, and so on. door.js writes it
to the browser console.
A team's hosted page has no server of yours to sign with, so its visitors are always anonymous.
SDK doors are different¶
If you are building your own product on AIR rather than embedding a widget, use an SDK door and the partner API: your server mints a session token for each person with its partner key. The identity secret doesn't apply there.
What the widget is, and isn't¶
The widget is deliberately minimal: a chat window, a text box and a send button. There is no theming, no attachments and no history view in it. For a richer experience, build your own interface on the JavaScript SDK.
The air-embed-js repository
https://github.com/Glowar-Ltd/air-embed-js holds an early copy of the
widget. It has not kept up — it has no signed identity — and it is not
published. Load door.js from the door, as above.
Related¶
- Opening a front door — the AIR side.
- Partner API — building your own front end instead.