SkaveloHelp Center

SDK reference

Options, methods and theme settings for the Skavelo SDK.

The SDK is published on npm as @skavelo/sdk.

npm install @skavelo/sdk
import { Skavelo } from '@skavelo/sdk';

const skavelo = Skavelo.init({
  agentId: 'YOUR_AGENT_ID',
  user: { id: currentUser.id, plan: currentUser.plan },
  theme: { position: 'bottom-right' },
});

With the script tag, the same API is available as window.Skavelo.

Skavelo.init(options)

Starts the widget and returns it. Calling init again with the same ID returns the same widget, so it's safe in code that runs more than once. During server rendering it returns a stand-in that does nothing.

OptionTypeDescription
agentIdstringThe agent to show everywhere. Found on the agent's Install tab.
workspaceIdstringInstead of agentId: show each page the agent whose Targeting matches it. See Multiple agents.
userobjectWho's signed in. The same fields as identify.
themeobjectAppearance settings that override the dashboard; see below.
actionsobjectHow skills call your app; see below.
diagnosticsobject{ network: false } stops the widget noting your app's failed requests. On by default. See What the widget sends.

theme

FieldDescription
accentAccent color, as a hex value such as #2F6BFF
background, textPanel background and text colors. Leave unset to follow the visitor's light or dark mode.
titleThe chat panel's title
labelThe launcher's text
iconAn image URL used in place of the Skavelo mark
position'bottom-center', 'bottom-right' or 'bottom-left'
offsetDistance from the edge of the screen, in pixels. Default 24.
highlight'beacon', 'spotlight', 'trace' or 'ring'. See Highlight styles.

actions

FieldDescription
headersA function returning extra headers for lookups and actions, such as a CSRF token or a bearer token. Called right before each request.
baseUrlWhere your API lives, if it isn't on the same site as the page

Cookies are always included in these requests, so lookups and actions run as the signed-in user.

Methods

MethodDescription
identify(user)Sets or updates the signed-in user. See Identify signed-in users.
open()Opens the widget
close()Closes the widget
ask(question)Opens the widget and asks a question for the user, for example from a help button in your app
startWorkflow(id, { intro })Plays one of the agent's walkthroughs by its id from the Product map. It doesn't ask the AI and doesn't count as a conversation. An introduction with the walkthrough's name and a Start button comes first; pass { intro: false } to start straight away, for example from your own "Show me how" button
event(name)Tells Skavelo something the user just did, like event('project_created'), so a walkthrough offer set for that event can show. Nothing is sent or stored
on(event, handler)Listens for a widget event
off(event, handler)Stops listening
destroy()Removes the widget from the page

Marking sensitive content

The widget never sends what users type into fields. To keep other parts of a page private too, such as account numbers shown on screen, add data-sk-sensitive to the element. Skavelo skips everything inside it.

<section data-sk-sensitive>
  Card ending 4242
</section>

On this page