Synchra.24
menu_bookDocumentation
Practical guides for setup and development

Find guides for getting started, building workflows and adding your own tools to your company workspace.

folderEmbedded services

Code, libraries, and SDK

JavaScript and React, embedded libraries, bridge, theme, and working with artifacts.

Machine translation

React and JSX

React and ReactDOM are included in the web version and are available in the preview and published service. The new service contains a React example with artifact reading. Specify the container in the HTML.:

<div id="root"></div>

In the tab JavaScript You can write JSX, functional components, and hooks.:

import React, { useState } from 'react';
import { createRoot } from 'react-dom/client';

function App() {
  const [count, setCount] = useState(0);
  return <button onClick={() => setCount(count + 1)}>Нажатий: {count}</button>;
}

createRoot(document.getElementById('root')).render(<App />);

Imports from react, react-dom/client, lodash and dayjs, as well as global React and ReactDOM. Explicitly call createRoot(...).render(...): the component is not mounted automatically. synchra.getArtifact() it works from handlers and effects; display loading and handle errors. Other third-party modules and TypeScript are not supported; CDN and direct network requests are also unavailable in the sandbox of the regular service. The usual service is performed in the sandbox without access to the authorization of the main site. The web widget uses the trusted code model described above in the Shadow DOM. The 5 MiB limit includes the service's sources; embedded React, Lodash, and Day.js and SDK are not taken into account.

The formatting button works with JSX. Errors in code preparation are shown in the logs panel; the source code remains in the editor. Regular JavaScript services continue to work.

Button ⓘ In the upper panel, next to the AI assistant and the update, the library's README opens. @synchra24/app from GitHub and an addendum about web bridge events in the documentation window. A complete guide to the events is provided below and in the section Event-based launch. Headings, lists, tables, and code examples are displayed in Markdown format. You can open the original on GitHub; if an error occurs, a re-download is available.

Lodash and Day.js

The libraries are built into the engine: they are available without CDN and without installing packages in the preview and published service. You can use global _ and dayjs or implants:

import _ from 'lodash';
import debounce from 'lodash/debounce';
import dayjs from 'dayjs';

const groups = _.groupBy(items, 'status');
const date = dayjs('13.10.2026', 'DD.MM.YYYY', true);
if (date.isValid()) console.log(date.format('DD.MM.YYYY'));
const moscowTime = dayjs.utc('2026-10-13T09:00:00Z').tz('Europe/Moscow');

Day.js uses the Russian locale by default; English is also embedded (dayjs.locale('en') or dayjs(value).locale('en')). The following plugins are already connected via dayjs.extend, no need to re-configure:

Plugins Opportunities
utc, timezone UTC and explicit conversion of time zones
customParseFormat, localizedFormat Parsing a given format, strict verification, and localized date output
relativeTime, duration Relative time and duration
isBetween, isSameOrBefore, isSameOrAfter, minMax Ranges, comparison, minimum and maximum date
isoWeek Weeks according to ISO

Imports dayjs/plugin/<name> allowed for the listed plugins, locales — dayjs/locale/ru and dayjs/locale/en. The main module and methods are available for Lodash via lodash/<method>. Do not use unspecified plugins or other locales: they are not included in the engine. Set the time zone explicitly according to the service's scenario; the browser time may differ from the company time.

Checking the bridge and the service key

At the start, check await synchra.isSynchraIntegrated() before context requests, artifacts, and other actions across the bridge. The buttons for such actions should be disabled until the verification is complete. false show a message about an unavailable bridge and do not comply with requests: The SDK returns false also, if the service key is rejected.

The engine automatically transmits SERVICE_TOKEN — the key of the current service — and creates synchra how new SynchraApp(SERVICE_TOKEN). Use a ready-made copy. Do not register the real key in the source code, do not output it to the logs, and do not replace it with a user or company token. For an external application, the URL key is specified when creating an SDK instance according to the library documentation; for an embedded service, the engine already does this.

const integrated = await synchra.isSynchraIntegrated();
if (!integrated) {
  // Покажите сообщение и оставьте действия моста отключёнными.
  return;
}
const artifact = await synchra.getArtifact('warehouse.stock');
// Отобразите artifact.value с обработкой загрузки, пустых данных и ошибок.

The example above is the body of an asynchronous function. The starting React template checks the bridge in useEffect, stores the verification result and allows downloading only when true. The same rules are included in the instructions for the AI assistant.

The preview emulates the bridge, passes the test key preview-service and returns a successful verification result for it. The key verification is performed on each call. Reading artifacts returns only the contents of the "Test Artifacts" tab. The test key does not provide access to the company's real data. You don't need to specifically disable integration verification for preview.

Colors and typography

After successful integration verification, read synchra.getSynchraTheme(): the synchronous method returns {active, current, themes} or null. The field names are the same on both platforms.: primary, secondary, text, title, elements, inputGrey, border, controlPrimary, error, success, button, buttonText, white. Take the colors from current the active theme is light or dark. In the mobile application, this is the palette of the mobile version; in the browser, it is the colors of the surrounding web interface, including translucent panels, margins, borders, and accents. The same service code works without a separate palette selection; if necessary, define the environment using synchra.getRuntime(). Track your changes via synchra.onSynchraThemeChange(callback). Call the returned unsubscribe function when unmounting. Update CSS variables without restarting the service.

Mobile palette for reference (do not fix these values in the web service code):

Role Theme Key Light / Dark
Background primary #e5e5e5 / #212529
Panels secondary #eeeeee / #343a40
Text text #242424 / #adb5bd
Headlines title #3a3a3a / #adb5bd
Icons, secondary text elements #50565c / #adb5bd
Fields inputGrey #d7d7d7bf / #343a40
The borders border #d4d4d4 / #131517ff
Accent controlPrimary #ffb703
Error / success error / success #f94144 / #52b788

Use dark text on the yellow buttons. #242424 in both topics. buttonText refers to neutral buttons. The web version and the web preview transmit the actual CSS colors of the web interface under the same keys; the mobile preview saves the mobile palette. themes The basic palettes of the current platform are found, and the active one is updated with calculated interface colors. For the current design, always use current: the values can be rgba(...) and the web accent may differ from the mobile yellow one. Changing the theme and emphasis triggers an SDK event and updates the standard CSS variables without restarting the service and losing its state. This works in regular services, Shadow DOM widgets, and URL-enabled bridge services. The service's colors, which are registered manually instead of accessing the SDK, are not automatically replaced.

Recommended sizes/line spacing in CSS pixels: main text 14/19, signatures 12/16, card headings 17/22 or 19/28, page title 25/31. Use 16px for iPhone fields, and at least 44px for click zones. The text is plain 400, highlighted 500-700, headings 700-800. The mobile application uses Google Sans and Manrope; in WebView, these fonts are not automatically inherited, so set a system replacement font without connecting a CDN. These rules are included in the instructions for the AI assistant and the starting template for new services. Existing publications are not automatically rewritten.

Recording artifacts from the embedded service

After checking the integration, call await synchra.setArtifact('service.settings', {enabled: true}). The name must already exist in this company; the method replaces the entire JSON, returns the updated version, and does not create a missing artifact. You need an API license and admin_edit_provider_integrations; maximum of 1 MiB per value. Web services, Shadow DOM widgets, and the updated mobile bridge use the same event. app.automation.artifact.set. In the old external SDK, use requestPayload with {name, value}. In the preview, only the test data is changed before the restart.

To read this data at all stages of automation, connect the upper block. artifacts; transform gets context.artifacts. Recording by itself does not trigger automation. Examples, API, and Errors.