API Reference

Overlay

A subtle, floating chat bubble that expands into a sleek slide-in panel on demand—delivering help exactly when users need it, without ever cluttering your main interface.

Prerequisite

This page assumes you’ve already installed Eucera SDK.


Installation

// using the api name of your agent
const AGENT_API_NAME = "playground";

eucera("when", "ready", () => {
  eucera.agent({
    apiName: AGENT_API_NAME, 
    mode: "OVERLAY"
  });
});

Configuration

The embedded agent supports both common and mode-specific settings. All attributes go under configuration.overlayConfiguration:

PropertyTypeDefaultRequiredDescription
isHandleLogoVisiblebooleantrueNoToggle the visibility of the handle logo.
layoutMode"WIDGET" | "SIDE_PANEL""SIDE_PANEL"NoSelect between the compact widget or the full side-panel overlay layout.
horizontalAlignment"LEFT" | "RIGHT""RIGHT"NoPosition the Agent on the left or right edge of the viewport.
verticalAlignment"TOP" | "CENTER" | "BOTTOM""CENTER"NoPosition the Agent at the top, middle, or bottom of the viewport.
isDraggablebooleantrueNoAllow end users to click and drag the Agent to reposition it on the screen.
hostWidthnumberwindow.top.innerWidthNoSet the overlay container’s width in pixels (defaults to the full browser window width).
eucera("when", "ready", () => {
  eucera.agent({
    apiName: AGENT_API_NAME, 
    mode: "OVERLAY",
    configuration: {
      overlayConfiguration: {
        hostWidth: window.innerWidth,
        isDraggable: false,
        verticalAlignment: 'BOTTOM',
        horizontalAlignment: 'LEFT',
        layoutMode: 'WIDGET',
        isHandleLogoVisible: true
      }
    }
  });
});

For the full list of shared options across all modes, see Common Configuration.


Programmatic Control API

Once your agent is initialized, you can call any of these methods on the returned instance. Each method returns the agent instance itself, so you can chain calls.

eucera("when", "ready", () => {
  const agent = eucera.agent({ /* …common setup… */ });
  // Now you can call any of the methods below:
  // agent.message(...).open().setViewType("WIDGET").hide()...
});

message(text: string): this

Programmatically send a chat message as if the user typed it.

agent.message("Hello, agent! What's on my agenda today?");

Overlay Controls

Open the overlay

agent.open();

Close the overlay

agent.close();

Visibility Controls

Show the agent

agent.show();

Hide the agent

agent.hide();

View Type

Switch between widget and side-panel layouts on the fly:

// Options: "WIDGET" or "SIDE_PANEL"
agent.setViewType("WIDGET");

Remove / Destroy

Tear down the agent completely—unmounts the UI, clears its state, and frees resources.

agent.remove();

Example: Chaining Multiple Calls

eucera("when", "ready", () => {
  eucera.agent({ /* …common setup… */ })
    .message("Let’s get started.")
    .open()
    .setViewType("SIDE_PANEL")
    .hide()
    .remove();
});


Live Playground

Try it out in our interactive demo: