Build a widget
A widget is a web page, plus the files it needs, packed in a .zip. It talks to Docktix through the Widget SDK. You choose the name, permissions and places in the upload form.
Would you rather have an AI assistant build it? See Build a widget with AI.
Steps
- Make an entry page, for example
index.html, that loads the SDK script. - Call
Docktix.init()once and wait for it before any other call. - Build your widget with the calls in the SDK reference.
- Zip the files and check them against the rules below.
- Upload the zip in Settings > Widgets. See Add and manage widgets.
html
<!doctype html>
<html>
<body>
<div id="app">Loading...</div>
<script src="https://sdk.docktix.com/sdk/v1/docktix-widget-sdk.js"></script>
<script>
Docktix.init()
.then((context) => {
document.getElementById('app').textContent = 'Hello ' + context.user.name;
})
.catch((error) => {
document.getElementById('app').textContent = error.code + ': ' + error.message;
});
</script>
</body>
</html>A widget works only when Docktix opens it. Opening its page directly in a browser makes init fail.
Zip rules
Docktix checks these when you choose the zip and tells you what to fix.
| Rule | Limit |
|---|---|
| Zip size | 8 MB |
| Number of files | 200 |
| Size of one file | 2 MB |
| Size once unpacked | 30 MB |
| File types | html, js, css, json, png, jpg, svg, woff2, map. Anything else is refused (for example .jpeg, .gif, .webp, .ico, .woff, .ttf, .txt). |
| File and folder names | Letters, digits and . _ - @ only. No spaces, no accented or non-English letters, no name that starts with a dot. Sub-folders are fine (for example assets/logo.svg). Names must differ by more than upper or lower case. |
| Entry page | An .html file inside the zip. If you zipped a folder, the folder name is part of the path (my-widget/index.html). It should load the SDK script, or the widget cannot talk to Docktix (you get a warning). |
| Menu icon | Not needed: Docktix shows its own icon for the left-menu tab. |
A zip made on a Mac is fine: the extra __MACOSX folder and .DS_Store files are ignored. Any other hidden file makes the upload fail.
Good to know
- Put
index.htmlat the top of the zip, not inside a folder, and name the entry page when you upload. - A widget can have one left-menu tab and also one button per module, at the same time. Labels are up to 40 characters.
- Pass modules to SDK calls by their API name: the
module_api_namefromDocktix.modules.list(). Themodule.apiin the context and theui.openRecordmodule use the same name. - Keep your widget's state in Docktix data. Do not rely on browser storage: it may be empty the next time the widget opens.
- Each widget may make up to 10 calls per second. See Call limit and timeouts.
- A popup widget can ask for its height with
Docktix.ui.resize. A left-menu tab fills the page. - Read lists in pages of up to 100 records rather than one call per record.
- Ask only for the permissions your widget needs. Administrators see them when they install it.