Add in-app support to a Tauri app

Give your Tauri v2 app a "Get help" button that shares your app's window with your support team, with consent, in your own name, colour and logo.

Embed
Preview of the card
<a href="https://gaiadesk.net/docs/tauri-in-app-support"><img src="https://gaiadesk.net/docs/_api/public/orgs/89a5df38-be2c-4963-8823-21d4bd40a2ab/spaces/57b99ea0-d45a-4986-8aa6-6b0683c9fe1d/pages/5a840463-5326-4c3b-bde9-f8580a3e7e4a/social-card.svg?v=3e7ae33eec8b" alt="Add in-app support to a Tauri app" width="600" height="315"></a>

Give your Tauri app a "Get help" button: your customer clicks it and agrees, and your support team sees your app's window in the GaiaDesk console — and, if you allow it, guides it — without the customer installing anything.

GaiaDesk's Tauri plugin works with Tauri v2 on macOS, Windows and Linux. It comes in two parts: the Rust plugin tauri-plugin-gaiadesk-support (on crates.io) and its typed TypeScript API @gaiadesk/tauri-plugin-support (on npm). Both are open source (MIT), at github.com/Gaia-Desk/gaiadesk-embed-tauri. They wrap the same signed native library, libgaiadesk_embed, as GaiaDesk's other embed SDKs; the library is a prebuilt binary that ships, unmodified, beside your app.

Not in a desktop app? Use the web SDK for a web page, the website widget for a one-line launcher on a site, or the Electron SDK.

Versions that go together

Part

Version

tauri-plugin-gaiadesk-support (crates.io)

0.5.0

gaiadesk-embed-fetch (crates.io, build helper)

0.5.0

libgaiadesk_embed (the native library it fetches)

0.4.0

@gaiadesk/tauri-plugin-support (npm)

0.5.0

@gaiadesk/consent (npm, optional: the consent step in your page)

0.1.x

Tauri

2.x (the crate needs tauri 2.11 or later)

The plugin has its own 0.x version line; it is not Tauri's 2.x. Keep the plugin crate, the fetch helper and the npm package on the same version. The fetch helper picks the library version for you: 0.5.0 fetches library 0.4.0. Plugin 0.5.0 (with library 0.4.0) adds the consent step. What is marked 0.4.0 below is new in plugin 0.4.0 (with library 0.3.0): the dialog attached to your window, Cancel while waiting, and the indicator's position. With an older library the plugin still works: before 0.4.0, consent, preview and recordConsent reject with unsupported (and so does startHelp given a consentToken or consentReceipt); with 0.2.0 the dialog is not attached to your window, the indicator ignores indicatorPosition and its place is not remembered, and a cancel while waiting ends as app_stopped.

What your customer sees

  • One button. Your app shows "Get help" wherever you put it.

  • A consent dialog in your colours. It names your company, says what will be shared (this app's window, or the screen if you chose it) and whether your team will be able to guide it. Nothing is shared until the customer agrees. 0.4.0: it is attached to the window that asked — a sheet on macOS, an owned window on Windows — so it is always in front of your app, never behind it (remote-URL webviews included); it follows the system's light or dark appearance, shows your logo large, and lists exactly what is shared. For a live preview, choices, who is waiting and a stored receipt, use the consent step. Prefer your own dialog? See Your own consent dialog.

  • An indicator for as long as anything is shared. "Sharing with Acme", drawn by the library on top of your app. Your app cannot hide it. In a guided session it also has Pause control. 0.4.0: it shows Cancel while the customer waits for an agent and Stop sharing once one joined; it stays on top, can be dragged (its place is remembered for your app, in <app data dir>/gaiadesk-support/indicator.json), starts clear of your window, and indicatorPosition (top-left, top-right, bottom-left, bottom-right) picks its corner.

  • A support code. Nine digits your customer can read to an agent over the phone.

When the session ends — the customer presses Stop sharing, your app stops it, the session expires, or the app quits — sharing stops at once and nothing is left behind: the library installs nothing, runs no service and writes nothing to disk (the plugin keeps only the indicator's place, in your app's data folder).

0.4.0: a customer who presses Cancel while still waiting, or your app calling stop() then, cancels the request: it leaves your team's Waiting list at once, no agent can join it, and ended carries reason: "customer_cancelled" (also the session's end_reason in the API).

What your support team sees

Agents open Support in the GaiaDesk console, see the waiting customer (with the details your app passed) and join, or type the support code. Only your own account and team can join, and only team members with a support seat.

1. Add the plugin

In src-tauri/:

cargo add tauri-plugin-gaiadesk-support@0.4
cargo add --build gaiadesk-embed-fetch@0.4

In your frontend:

npm install @gaiadesk/tauri-plugin-support@0.4

Register it in src-tauri/src/lib.rs (or main.rs):

tauri::Builder::default()
    .plugin(tauri_plugin_gaiadesk_support::init())

And allow it in your window's capability (src-tauri/capabilities/default.json): add "gaiadesk-support:default" to permissions. Grant it only to windows that should offer help.

2. Bundle the library

src-tauri/build.rs fetches the library for the platform you build for, and refuses it unless its SHA-256 matches the hash pinned in the helper:

fn main() {
    gaiadesk_embed_fetch::fetch("gaiadesk").expect("libgaiadesk_embed");
    tauri_build::build();
}

Then ship it with your app, with one platform file per OS beside tauri.conf.json. Tauri reads tauri.conf.json, then merges tauri.macos.conf.json, tauri.windows.conf.json or tauri.linux.conf.json over it as a JSON Merge Patch (RFC 7396). That means:

  • Objects merge key by key. A bundle.resources map in a platform file adds its entries to the map in tauri.conf.json; your own entries stay.

  • Lists are replaced whole. If tauri.conf.json lists resources as an array ("resources": ["icons/logo.png"]), the platform file's map replaces it on that platform and your entries are gone. Write resources as a map ("source": "target") in tauri.conf.json too. The same goes for bundle.macOS.frameworks: if you already list frameworks, repeat them in tauri.macos.conf.json.

So the platform files hold only the GaiaDesk entries:

// src-tauri/tauri.macos.conf.json
{ "bundle": { "macOS": { "frameworks": ["gaiadesk/libgaiadesk_embed.dylib"] },
              "resources": { "gaiadesk/LICENSE-BINARY": "gaiadesk/LICENSE-BINARY" } } }

// src-tauri/tauri.windows.conf.json
{ "bundle": { "resources": { "gaiadesk/gaiadesk_embed.dll": "gaiadesk/gaiadesk_embed.dll",
                             "gaiadesk/LICENSE-BINARY": "gaiadesk/LICENSE-BINARY" } } }

// src-tauri/tauri.linux.conf.json
{ "bundle": { "resources": { "gaiadesk/libgaiadesk_embed.so": "gaiadesk/libgaiadesk_embed.so",
                             "gaiadesk/LICENSE-BINARY": "gaiadesk/LICENSE-BINARY" } } }

and your existing resources stay in tauri.conf.json, as a map:

// src-tauri/tauri.conf.json
{ "bundle": { "resources": { "icons/logo.png": "icons/logo.png" } } }

On Windows, for example, the bundle then gets all three: icons/logo.png, gaiadesk/gaiadesk_embed.dll and gaiadesk/LICENSE-BINARY.

On macOS the library goes in Contents/Frameworks, so Tauri signs and notarizes it with your app. Add src-tauri/gaiadesk/ to your .gitignore.

How the build fetches the library

gaiadesk_embed_fetch::fetch("gaiadesk"), run from build.rs:

  • Downloads the archive for the target from the gaiadesk-embed-cpp v0.4.0 release: gaiadesk_embed-macos-universal.tar.gz, gaiadesk_embed-win-x64.zip or gaiadesk_embed-linux-x64.tar.gz. It uses curl and tar, which macOS, Linux and Windows 10 and later have.

  • Verifies the archive's SHA-256 against the hash pinned in the helper (PINNED in gaiadesk-embed-fetch's src/lib.rs). A mismatch is an error, nothing is unpacked, and the build stops.

  • Places the library and LICENSE-BINARY in src-tauri/gaiadesk/, and copies them beside the dev executable (target/<profile>/gaiadesk/) so tauri dev finds them.

  • Caches in that same src-tauri/gaiadesk/ folder: it writes the pinned hash to src-tauri/gaiadesk/.sha256, and while the library and that stamp are there it does not download again. There is no shared cache between projects, and cargo clean does not remove it. Delete src-tauri/gaiadesk/ to fetch again.

  • On a target with no prebuilt library (Windows on Arm, Linux arm64) it prints a cargo warning and the build goes on; startHelp then rejects with library_missing.

Offline builds and mirrors

Two environment variables change where the build gets the library:

Variable

GAIADESK_EMBED_ROOT

A folder holding an unpacked release archive (lib/libgaiadesk_embed.dylib, bin/gaiadesk_embed.dll or lib/libgaiadesk_embed.so, and LICENSE-BINARY). Nothing is downloaded and the files are copied as they are: this path is not hash-checked, so unpack an archive you verified.

GAIADESK_EMBED_BASE_URL

Where the archives are, instead of the GitHub release: your own mirror over https://, or file:// for a local folder. Same file names; still checked against the pinned hashes.

Changing either one reruns the build script. If src-tauri/gaiadesk/ already holds the pinned version from an earlier download, it is used as it is; delete the folder for the variable to take effect.

At run time, GAIADESK_EMBED_LIBRARY is the full path of the library file to load, ahead of every other place the plugin looks (the config's libraryPath, then Contents/Frameworks on macOS, then gaiadesk/ in your app's resources, then gaiadesk/ beside the executable).

3. Choose how sessions are created

A publishable key (no backend)

On your GaiaDesk account page, open API keys, create a Publishable key, and register your app's origin: app:// followed by your Tauri identifier, in lowercase — for com.acme.desk, app://com.acme.desk.

A publishable key can do one thing: create support sessions, at most an hour long, for that app. It is safe to ship inside your app. The customer details it sends are your app's word, and the console shows them as unverified.

Put it in tauri.conf.json, with your name and look:

"plugins": {
  "gaiadesk-support": {
    "publishableKey": "pk_live_…",
    "company": "Acme",
    "branding": { "color": "#0f766e", "logo": "icons/logo.png" }
  }
}

startHelp() then needs nothing else: it asks, creates the session and starts.

Use a pk_live_… key in your release, and a pk_test_… key while you build: test sessions work end to end but are marked livemode: false and appear only under the console's Test filter. Keys made before the prefixes, ak_…, still work until 2027-02-15: re-issue them as pk_live_….

Never a secret key. Anything in tauri.conf.json ships inside your app, so the plugin refuses a secret key (sk_live_…, sk_test_…) twice:

  • At build time. The plugin's build script reads the config the Tauri CLI passes it (tauri.conf.json, the platform files and --config, merged) and fails the build if it holds an sk_ key. A plain cargo build without the Tauri CLI skips this check.

  • At run time. startHelp rejects with secret_key_in_app, before any dialog or request, when the configured key, a Builder key or a publishableKey option starts with sk_.

Sessions created with a publishable key also send your app's client details (OS, OS version, app version, and the SDK: tauri-plugin-gaiadesk-support with its version), which agents see on the waiting customer's card.

The request comes from the plugin's Rust side, not from your webview, and it always carries Origin: app://<identifier>. That is why the key is registered for app://…, whatever your webview has loaded.

Sessions from your own backend

If you would rather decide on the server who may get help, and pass verified customer details, create the session there with a secret API key (scope support) and hand the app only its embed token:

curl -s -X POST https://api.gaiadesk.net/v1/support/sessions \
  -H "Authorization: Bearer $GAIADESK_API_KEY" -H "Content-Type: application/json" \
  -d '{"mode": "cobrowse", "customer": {"name": "Ada", "plan": "pro"}, "origin": "app://com.acme.desk"}'

origin is optional. If you pin one, make it your app's app://<identifier>: the library connects without an Origin, which only an app:// pin admits, so a session pinned to an https:// origin is refused (origin_not_allowed).

The answer is 201 Created with the whole session:

{
  "id": "ss_0123456789abcdef",
  "object": "support_session",
  "livemode": true,
  "state": "waiting",
  "mode": "cobrowse",
  "customer": { "name": "Ada", "plan": "pro" },
  "customer_present": false,
  "customer_verified": true,
  "join_code": "123456789",
  "join_url": "https://gaiadesk.net/app/support.html#session=ss_0123456789abcdef",
  "desk_id": null,
  "origin": "app://com.acme.desk",
  "owner": "you@acme.com",
  "external_id": null,
  "metadata": {},
  "created_at": 1767225600,
  "expires_at": 1767229200,
  "joined_at": null,
  "joined_by": null,
  "ended_at": null,
  "end_reason": null,
  "duration_seconds": null,
  "client": null,
  "admin_url": null,
  "connected_at": null,
  "notes": null,
  "outcome": null,
  "csat": null,
  "consent": null,
  "estimated_wait_seconds": 45,
  "embed_token": "gdemb_3f9a1c7e5b2d4f60819a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f70"
}

created_at, expires_at, joined_at and ended_at are Unix times in seconds (numbers, not strings). expires_at is created_at plus expires_in (default 3600). livemode is false for a test key's session. estimated_wait_seconds is your team's typical wait for an agent, or null until GaiaDesk has an estimate. embed_token is gdemb_ and 64 hex characters, shown only in this answer. Your app passes it on:

await startHelp({ embedToken, guided: true });

Your backend may also send external_id (your ticket or user id), metadata, client and admin_url (your admin page for this customer); see In-app support.

Never ship the secret key in your app: the embed token is all it needs. Every field, status and error is in the support API reference.

Remote-URL apps

If your window loads your site ("url": "https://yourapp.com" in app.windows) rather than bundled files, three things matter:

  • The key's origin is still app://<identifier>. The plugin creates the session from Rust with Origin: app://<identifier>, not from your page, so register app://com.acme.desk on the publishable key. The key may list https://yourapp.com as well, if the same key also serves the web SDK in browsers; the plugin does not need it.

  • Your page imports the plugin's API itself. Bundle @gaiadesk/tauri-plugin-support into your site's own JavaScript.

  • The capability must name the remote URL. Tauri gives a capability to remote pages only through its remote.urls, which are URLPattern strings (https://yourapp.com matches every path on that host; https://*.yourapp.com matches its subdomains):

// src-tauri/capabilities/remote-help.json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "remote-help",
  "description": "Lets yourapp.com, loaded in the main window, start GaiaDesk support.",
  "windows": ["main"],
  "remote": { "urls": ["https://yourapp.com"] },
  "permissions": ["gaiadesk-support:default"]
}

Any page on those URLs can then start, watch and stop a support session in that window, so list only the origins you control.

4. Add the button

import { mountHelpButton, on } from "@gaiadesk/tauri-plugin-support";

mountHelpButton("#help", { customer: { name: "Ada", plan: "pro" } });
on("started", ({ code }) => showStatus(`Your support code is ${code}`));

That is the whole integration. The button asks, creates the session, starts sharing, and becomes "Stop sharing" while the session lasts. Or wire your own button to startHelp(options) and stop().

branding (in the plugin config, or per call to startHelp) puts your brand on the consent dialog and on the "Sharing with Acme · Stop" indicator:

branding

name

"Sharing with Acme". Default: the config's company, then your app's product name.

color

Accent colour, #RRGGBB.

logo

A PNG: a path, an https:// URL, a data:image/png;base64, URL, or "$appIcon" (your app's own window icon).

A relative logo path is read from your app's bundled resources directory (Tauri's resource_dir(): Contents/Resources in a macOS app), so it must be listed in bundle.resources with that target path: "logo": "icons/logo.png" needs "icons/logo.png": "icons/logo.png" in the resources map. An absolute path is read as it is. "$appIcon" uses Tauri's default window icon (bundle.icon), so nothing needs bundling.

A logo never stops a session. One over 256 KiB (262,144 bytes, the library's limit) is downscaled until it fits, from sources up to 8 MiB. One that cannot be read, downloaded or decoded, or is not a PNG, is a warning event ({code: "bad_logo", message}), and the session goes on with your name and colour only. A bad color still rejects with bad_color.

Colour and logo need version 0.2.0 or later of the library; the plugin fetches 0.4.0.

Guided sessions

By default your team can only look. To let them click and type, create the session as cobrowse (mode: "cobrowse") and pass guided: true — both ends must want it. Their input is delivered inside your app's own process, only to your app's windows, only while your app is in front, never under a mask, and at most 20 actions a second. Your customer can pause it at any time from the indicator; your app can too (pause()). Linux is view-only.

Keeping things private

  • Your app's window only. Other apps, notifications and the desktop are never captured, unless you choose capture: "screen".

  • Masks. Mark anything sensitive — card numbers, balances — with data-gaiadesk-mask. It is painted black before a frame is encoded, from the very first frame, and follows the element as it moves. If the window cannot be located, the whole picture is blacked out. You can also pass rectangles, or call setMasks() yourself.

  • Secrets are masked by default. Password fields and fields whose autocomplete is a card field (cc-*), one-time-code, current-password or new-password are always masked, whatever selector you pass. Put data-gaiadesk-unmask on an element (or an ancestor) to show it anyway; an element that carries data-gaiadesk-mask itself stays masked. Rectangles you pass yourself are used as they are.

  • Consent every time. The library refuses to start without it. You may ask in your own dialog instead of the library's (consentGranted: true, below); no setting hides the indicator.

To see what is masked while you develop, turn on the overlay. It outlines every masked region in red. The outlines are part of your page, so an agent in a session sees them too: use it in development only.

import { showMaskOverlay, maskedElements } from "@gaiadesk/tauri-plugin-support";

showMaskOverlay(true);              // or startHelp({ debugMasks: true })
console.log(maskedElements());      // the elements that would be masked
showMaskOverlay(false);

Ask with GaiaDesk's consent step rather than startHelp's plain dialog or your own UI with consentGranted: true. It shows your customer a live preview of exactly what support will see (masked fields blacked out), lets them choose (view only or click-and-type, app logs, this window or the screen), says who is waiting and for how long, links your privacy policy and terms, can auto-decline after a timeout, is localized (14 languages, right to left included) and themed to your app, and leaves a receipt stored on the session (see Proof of consent). A decline or timeout ends the waiting request at once (customer_declined / consent_timeout). Needs libgaiadesk_embed 0.4.0 (plugin 0.5.0).

In your page (Tauri always has a webview, so this is the usual choice): the @gaiadesk/consent web component, with this plugin as its bridge. The library takes the preview and makes the receipt.

import '@gaiadesk/consent'; // registers <gaiadesk-consent>
import { consentBridge, startHelp } from '@gaiadesk/tauri-plugin-support';

async function getHelp() {
  const el = document.body.appendChild(document.createElement('gaiadesk-consent'));
  el.bridge = consentBridge;
  const d = await el.open({ company: 'Acme', guided: true, masked: true, choices: { offer_logs: true } });
  el.remove();
  if (d.decision !== 'accepted') return;
  await startHelp({ guided: true, consentToken: d.consent_token, consentReceipt: d.receipt });
}

consentBridge posts an accepted receipt with startHelp. When your backend already created the session, use createConsentBridge({ embedToken, sessionId }) instead: it also shows who is waiting, and every receipt (a decline too) is posted at once.

The library's dialog, a native window attached to yours, with the same options:

import { consent, on, startHelp } from '@gaiadesk/tauri-plugin-support';

on('consent_declined', ({ reason }) => track('consent_declined', reason)); // "declined" | "timeout"
const d = await consent({ company: 'Acme', guided: true, theme: { accent: '#5b4cf0' }, timeout_seconds: 120 });
if (d.decision === 'accepted') await startHelp({ guided: true, consentToken: d.consent_token, consentReceipt: d.receipt });
// "unavailable": no dialog on this system (Wayland without XWayland): use <gaiadesk-consent>.

The options are the library's (snake_case, every key optional), the same object the web component takes: company, capture, guided, masked, brand_color, logo_png_base64, theme (appearance, background, surface, text, accent, radius, font_family, button_style), locale, wording (per-key overrides), wording_version, choices (offer_guided, offer_logs, offer_capture), privacy_url, terms_url, timeout_seconds, preview, server / embed_token / session_id (then the library shows who is waiting and posts the receipt), app_version, window_id, masks. The plugin fills company and the brand from its config, parent_window (the calling window) and app_version; masks are CSS pixels of the page. The decision is {decision: "accepted" | "declined" | "timeout" | "unavailable", choices, consent_token, receipt}; startHelp given consentToken skips its dialog, and capture and guided follow your customer's choices.

Also: preview(request) (one PNG frame of what support would see, capture_unavailable without permission), recordConsent(input) (your own UI's answer made into a receipt, surface: "embedded") and waitInfo({ embedToken, sessionId }). The types are ConsentOptions, Decision, ConsentReceipt and Choices (Rust: ConsentOptions).

The library's dialog is the default. To ask in your own UI, ask first and pass consentGranted: true — a supported path, not a workaround. Your dialog must:

  • be shown every time, right before startHelp, and start only on an explicit yes;

  • say who will see what (this window, your app's windows, or the whole screen), whether they may guide it, that private fields stay hidden, and how to stop.

The "Sharing with …" indicator is shown either way and cannot be hidden: it is how your customer stops. The minimum wording (adapt the style, keep every point):

Share this window with Acme support?

Acme's support team will see this window until you stop sharing. Nothing else on your computer is shared.

  • They see this window only (capture: "app": this app's windows; "screen": your whole screen, including other apps)

  • View only: they cannot click or type (guided: they may click and type in this app; you can pause that any time)

  • Passwords and private fields stay hidden

  • Stop any time with "Stop sharing" on the Acme bar

[Don't Share] [Share]

const yes = await myDialog.confirm(/* the wording above */);
if (yes) await startHelp({ consentGranted: true });   // same capture and guided as you described

What you pass must match what you said: a dialog that said "view only" must not start with guided: true, nor one that said "this window" with capture: "screen".

What each platform supports

Capture

Guided input

Consent dialog

macOS 12.3 or later (universal: Apple silicon and Intel)

window, screen

yes

native, branded

Windows 10 and 11 (x64)

window, screen

yes

native, branded

Linux x64 (X11)

window, screen

view-only

in your webview

  • macOS: your app needs the Screen Recording permission (see below). Guided input needs no Accessibility permission.

  • Windows: nothing to install; the library needs the Visual C++ runtime most apps already ship.

  • Linux: with library 0.4.0, startHelp's dialog and consent() are the library's native dialog on X11 or XWayland. On Wayland without XWayland there is none: startHelp asks in your app's webview instead (your own dialog, askConsent, or the browser-style confirm by default), consent() answers unavailable, and <gaiadesk-consent> in your page works everywhere.

macOS Screen Recording

startHelp checks the Screen Recording permission first. When it is not granted, the plugin emits permission_required ({permission: "screen", restartRequired: true}) and rejects with permission_required, before any dialog or session. So no agent ever joins a session that cannot share.

import { screenPermission, requestScreenPermission,
         openScreenPermissionSettings } from "@gaiadesk/tauri-plugin-support";

if ((await screenPermission()) !== "granted") {
  await requestScreenPermission();        // macOS's own prompt, the first time only
  await openScreenPermissionSettings();   // already refused? open the switch in System Settings
}

macOS cannot tell "never asked" from "refused", so screenPermission() answers granted or denied. After a grant, your app must be relaunched before it counts. mountHelpButton calls requestScreenPermission() for you on permission_required. Windows and Linux always answer granted.

Check what this build can do

getInfo() never throws. In a build without the plugin (an older version of your app) it answers { available: false }, so a shared frontend can hide its help button without try/catch:

import { getInfo } from "@gaiadesk/tauri-plugin-support";

const info = await getInfo();
// { available: true, pluginVersion: "0.5.0", libraryVersion: "0.4.0", libraryFound: true,
//   libraryPath: "…/Frameworks/libgaiadesk_embed.dylib", libraryError: null, platform: "macos",
//   guidedSupported: true, screenPermission: "granted", company: "Acme" }
if (!info.available || !info.libraryFound) hideHelpButton();

guidedSupported is false on Linux (view-only). libraryError says why the library could not be loaded (library_missing, library_unusable).

The wait and the rating

The started event and status() carry estimatedWaitSeconds: your team's typical wait for an agent, when GaiaDesk has an estimate (sessions from a publishable key or from a request), else null.

on("started", ({ code, estimatedWaitSeconds }) => {
  showStatus(estimatedWaitSeconds
    ? `Code ${code}. Usually answered in about ${Math.ceil(estimatedWaitSeconds / 60)} min.`
    : `Code ${code}.`);
});

When a session ends, ended carries canRate. Ask your customer however you like, then send the answer with rate():

on("ended", async ({ canRate }) => {
  if (canRate) await rate(5, "Quick fix, thanks!");   // 1 to 5; comment optional, at most 500 characters
});

A session can be rated once, within 24 hours of its end. The rating shows on the session in the console and in the support.session.rated webhook. The plugin keeps the session's embed token in memory (never on disk) until then. Refusals: already_rated, rating_window_closed, bad_rating, bad_comment, and no_session when there is nothing to rate.

Sending logs

Your app can offer your support team its logs. Nothing is sent until your customer agrees:

import { attachDiagnostics, startHelp } from "@gaiadesk/tauri-plugin-support";

await attachDiagnostics({ files: [logPath], text: JSON.stringify(appState), maxBytes: 2_000_000 });
await startHelp();   // after the consent dialog: "Also share app logs with Acme support?"

The question comes right after your customer agrees to share, or at once if a session is already up. It is a small dialog drawn in your page; pass askDiagnostics(question) to startHelp or attachDiagnostics to ask with your own UI. A no discards what was attached.

Each file is sent as its last maxBytes (10 MiB at most, and by default); text is sent as diagnostics.txt. A session takes at most 10 attachments and 25 MiB. They appear on the session in the console, are kept 30 days, and fire support.session.attachment_added. A file that cannot be read is skipped with a warning; diagnostics_sent lists what was uploaded. The plugin's Rust side reads the files, so any path your app can read can be attached: attach only what you mean to. deny-attach-diagnostics in a capability forbids it.

When an agent asks to share

An agent can ask a signed-in customer to share, from the console ("Ask to share"). Your backend vouches for the user: it mints a listen token with your secret key and your own id for that user, and hands it to their app.

curl -s -X POST https://api.gaiadesk.net/v1/support/listeners \
  -H "Authorization: Bearer $GAIADESK_SECRET_KEY" -H "Content-Type: application/json" \
  -d '{"external_id": "user-4411", "expires_in": 604800}'
# → 201 {"id": "sl_…", "listen_token": "gdlis_…", "external_id": "user-4411", "livemode": true, "expires_at": …}

The app listens and answers:

import { listen, on, acceptRequest, declineRequest, stopListening } from "@gaiadesk/tauri-plugin-support";

await listen({ listenToken });             // gdlis_…, from your backend
on("request", async (r) => {
  if (await myPrompt(`${r.company} support would like to see this app. ${r.message ?? ""}`)) {
    await acceptRequest(r.id, { guided: true });   // the consent dialog still shows
  } else {
    await declineRequest(r.id);
  }
});
on("request_closed", ({ id }) => closeMyPrompt(id));  // expired, or answered elsewhere
// at sign-out:
await stopListening();

The plugin holds the stream, reconnects after a network error, tells you each request once, and stops for good (listen_stopped) when the token is revoked, expires or is refused. A request expires 10 minutes after it was made. acceptRequest shows the consent dialog first; a no declines the request.

Events and commands

on(name, handler) returns a promise of the function that stops listening. The Tauri event names are gaiadesk-support:<name>.

Event

Payload

started

{code, sessionId, mode, expiresAt, estimatedWaitSeconds}

joined / left

{agent} / {}

paused

{paused}

action

{action, applied, reason}

error

{code, message}

ended

{reason, canRate}; always last. reason: stopped, app_stopped, customer_cancelled, customer_declined, consent_timeout, disconnected, expired, error

state

{state, choices?}: starting, waiting, connected, ended; waiting carries choices ({guided, share_logs, capture})

consent_shown

{locale, wording_version}: consent()'s dialog is up

consent_accepted

{choices}

consent_declined

{reason}: declined or timeout

warning

{code, message}: bad_logo, diagnostics_skipped, a refused upload

permission_required

{permission, restartRequired}

diagnostics_sent

{attachments}

listening / listen_stopped

{} / {reason, message}

request / request_closed

{id, company, mode, message, expiresAt} / {id, state}

Commands: startHelp, stop, pause, resume, setMasks, status, consent, preview, recordConsent, waitInfo, getInfo, screenPermission, requestScreenPermission, openScreenPermissionSettings, rate, attachDiagnostics, listen, stopListening, acceptRequest, declineRequest, showMaskOverlay. gaiadesk-support:default allows them all; each has its own allow-* and deny-* permission.

Refusals reject with a SupportError whose code is, among others, declined, busy, no_session, library_missing, secret_key_in_app, permission_required, not_listening, create_failed, bad_color, bad_options, unsupported (the consent step on a library before 0.4.0), or the server's reason (too_many_open_sessions, request_expired, …).

What is and is not permitted

You may: ship the prebuilt library unmodified inside your app, with its licence in your app's notices; offer support sessions to your own customers; brand the dialog and indicator with your name, colour and logo.

You may not: modify, decompile or re-sign the library separately from your app; hide or imitate the indicator; start a session without your customer's agreement.

See the plugin's README for every option, event and error code.

Updated