Send and receive messages
This reference provides message types, payload shapes, and usage patterns for communication between your embedded app and the product via postMessage. Use this document to look up which messages the product sends (handshake, auth context, logout) and which messages your app sends (ready signal, token request, error).
Messages from Atlan to your app
ATLAN_HANDSHAKEmessageRequired
ATLAN_HANDSHAKEmessageSent immediately after the iframe loads.
{
type: 'ATLAN_HANDSHAKE',
payload: {
appId: string
}
}
ATLAN_AUTH_CONTEXTmessageRequired
ATLAN_AUTH_CONTEXTmessageSent after your app responds with IFRAME_READY, on token refresh, and in response to IFRAME_TOKEN_REQUEST.
{
type: 'ATLAN_AUTH_CONTEXT',
payload: {
token: string,
expiresAt: number,
user: {
id: string,
username: string,
email: string,
name: string
},
page: {
route: string,
params: Record<string, string | string[]>,
query: Record<string, string | string[]>
},
timestamp: number
}
}
For a complete payload, see Auth payload.
ATLAN_LOGOUTmessageRequired
ATLAN_LOGOUTmessageSent when the user logs out or the session ends.
{
type: 'ATLAN_LOGOUT'
}
Messages from your app to Atlan
IFRAME_READYmessageRequired
IFRAME_READYmessageRequired. Send this after your app initializes and is ready to receive auth context.
{
type: 'IFRAME_READY'
}
IFRAME_TOKEN_REQUESTmessageOptional
IFRAME_TOKEN_REQUESTmessageRequest a fresh token.
{
type: 'IFRAME_TOKEN_REQUEST'
}
IFRAME_ERRORmessageOptional
IFRAME_ERRORmessageReport an error that Atlan can display to the user.
{
type: 'IFRAME_ERROR',
payload: {
message: string
}
}
Minimal message handling example
const ATLAN_ORIGIN = 'https://your-tenant.atlan.com'
window.addEventListener('message', (event) => {
if (event.origin !== ATLAN_ORIGIN) return
const { type, payload } = event.data || {}
switch (type) {
case 'ATLAN_HANDSHAKE':
// Never use '*' as targetOrigin.
window.parent.postMessage({ type: 'IFRAME_READY' }, ATLAN_ORIGIN)
break
case 'ATLAN_AUTH_CONTEXT':
console.log('Authenticated user:', payload.user.username)
break
case 'ATLAN_LOGOUT':
// Clear any cached session state
break
}
})
See also
- Auth payload: Token, user, and page fields
- Embed your app: Working integration example (SDK and manual)
- Connection and authentication issues: Common handshake and timeout errors