# intouch api base https://api.in-touch.cc auth X-API-Key: itk_<64 hex> one key per user, no expiry, no scopes docs https://docs.in-touch.cc format every response is JSON and carries "success" # embed-api Events the frame sends, commands it accepts, JS surface of . # events Each arrives as a DOM event on the element and as a postMessage for raw iframes. intouch:ready { version } frame is up, accepts commands intouch:themeApplied { warnings[] } after every theme application intouch:paired {} a visitor linked their account intouch:unpaired { reason } signed out or session expired intouch:unread { count } number of unread chats changed intouch:activeChat { hasActive } a chat was opened or closed intouch:error { code } storage_blocked | pair_rate_limited | peer_not_found | peer_rate_limited THIS LIST IS EXHAUSTIVE AND IT IS A PROMISE. No event carries a name, phone number, chat id, avatar, token or message content. # commands setTheme(theme) apply a theme live, no reload colorScheme property auto | light | dark | host lang attribute interface language logout() sign the visitor out of this frame requestStorageAccess() ask for unpartitioned storage (needs user gesture) Raw iframe form: frame.contentWindow.postMessage( { source: 'intouch-host', type: 'intouch:setTheme', theme }, 'https://web.in-touch.cc'); The frame accepts commands only from the origin given at load time. # js Event listeners can be attached at any time - they survive the upgrade. Methods and properties cannot: with an async-loaded script, wait for the definition first (or drop "async" from the script tag). const chat = document.querySelector('intouch-chat'); // works immediately, even before embed.js has loaded chat.addEventListener('intouch:unread', e => { badge.textContent = e.detail.count; }); // methods need the element to be defined await customElements.whenDefined('intouch-chat'); await chat.ready; chat.setTheme({ colors: { accent: '#0a0' } }); chat.colorScheme = 'dark'; # attributes theme inline JSON, or a hosted id such as t_9fb2c1a4e803 color-scheme auto | light | dark | host peer phone number of the counterpart (international form) lang interface language, e.g. de base alternative inTouch origin (defaults to the script's origin) unread written BY the component, for styling via [unread] A