APTalkmoji Vue SDK
Docs›Libraries

Vue SDK

Embed the Talkmoji talking agent into any Vue 3 application with a single component. Works with Vite, Nuxt, and the Vue CLI.

Installation

npm install @avatar-platform/vue
# or
yarn add @avatar-platform/vue
# or
pnpm add @avatar-platform/vue
ℹ️

The Vue SDK mounts the real embed-loader.js script — the same one behind the plain <script data-bot> snippet on your dashboard's Install code step. No bundler configuration is needed. Requires Vue 3 (Composition API).

AvatarWidget

The primary component. Place it once, typically near your root layout so it persists across route changes. It renders nothing visible itself.

<script setup>
import { AvatarWidget } from '@avatar-platform/vue';
</script>

<template>
  <YourApp />
  <AvatarWidget server-url="https://your-deployment.com" bot-id="YOUR_BOT_ID" />
</template>

Props

PropTypeDefaultDescription
server-url string — Required. Base URL of your Talkmoji deployment, no trailing slash.
bot-id string — Required. The public ID of your project. Find it in the dashboard → Install code step.
⚠️

There's no position/theme/open/close prop — those are configured per-project in your Talkmoji dashboard's Widget settings, not overridable per-mount.

Async Q&A (no widget UI)

For headless integrations — asking questions without showing the animated character — use askAvatar directly:

import { askAvatar } from '@avatar-platform/vue';

const { answer, sources, sessionId } = await askAvatar({
  serverUrl: 'https://your-deployment.com',
  botId: 'YOUR_BOT_ID',
  question: 'What payment methods do you accept?',
});

console.log(answer);   // AI answer string
console.log(sources);  // { title, url, snippet }[] — source files used

This calls POST /embed/:publicId/ask over HTTPS — no widget, no voice, no Rive. Pass the returned sessionId back in on the next call to continue the same conversation.

askAvatar options

OptionTypeDefaultDescription
serverUrlstring—Required.
botIdstring—Required.
questionstring—Required.
sessionIdstring—Optional — continue an existing conversation instead of starting a new one.

TypeScript types

Type declarations are included.

import type { AskAvatarOptions, AskAvatarResult } from '@avatar-platform/vue';

interface AskAvatarResult {
  answer: string;
  sources: { title: string; url: string | null; snippet: string }[];
  sessionId: string;
}

Nuxt 3 example

Wrap the component in a <ClientOnly> block so it never runs during server-side rendering, and place it in your root layout:

<!-- layouts/default.vue -->
<script setup>
import { AvatarWidget } from '@avatar-platform/vue';
const config = useRuntimeConfig();
</script>

<template>
  <slot />
  <ClientOnly>
    <AvatarWidget
      :server-url="config.public.avatarPlatformUrl"
      :bot-id="config.public.avatarBotId"
    />
  </ClientOnly>
</template>
⚠️

SSR note: The widget renders on the client only. In Nuxt, mounting it outside <ClientOnly> is safe too — the component itself is a no-op during SSR — but <ClientOnly> avoids a hydration mismatch warning.