Skip to content
DaneshyarDocs
Sign in
  • Introduction
  • Quickstart
  • What is Daneshyar?
  • The Apps page
  • Inside an app
  • Workspace: files and chat
  • Sharing and members
  • Notes and dictation
  • Language practice
  • Appointment booking
  • Automations
  • The file reader
  • Your profile
  • Wallet
  • Customer chats
  • API keys
  • Authentication
  • Apps, workspaces, resources
  • Ingestion
  • Chat and sessions
  • Citations
  • Skills
  • Conventions
  • Workspaces
  • Resources
  • Chat
  • Skills
  • Errors
  • Customer support assistant
  • Internal knowledge base
  • Documentation chatbot
  • Academy tutor
  • Embedded widget
  • Widget configuration
  • Framework guides
  • Security
  • Troubleshooting
  • FAQ
  1. Docs
  2. Embedded widget
  3. Widget configuration

Widget configuration

Every option the widget reads, with defaults, and a builder that writes the snippet for you.

You configure the widget with data-* attributes on its script tag. There is no JavaScript config object and nothing to call. Only three attributes are required.

Build your snippet

Change an option to see the snippet change. The ids in it are examples. The console's Embed page gives you the real snippet with your own ids, and it saves your look for the workspace when you press Save.

Mode
Position
Theme
Language
Your snippet
<script
  src="https://app.daneshyar.info/widget.js"
  data-api-key="sk_9f3aC2xQ7mB1vT8sE4nK6pR0jY5wZ2hL"
  data-app-id="2d7c0e91-4a5b-4f8e-b3c6-9e1f0a7d5c42"
  data-workspace-id="8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f"
  async
></script>

Only options you changed are added. Anything left out uses its default.

Required attributes

Without all three, the script stops and writes an error in the browser console.

AttributeTypeDescription
data-api-key* (required)stringYour app's public widget key (pk_…). It is visible in your page source, and it can only ask questions.
data-app-id* (required)uuidThe id of the app the workspace belongs to.
data-workspace-id* (required)uuidThe workspace the widget answers from.

Optional attributes

Leave out any attribute to use its default.

AttributeTypeDescription
data-locale"fa" | "en"The language of the widget's own text and its reading direction.Default: fa
data-mode"bubble" | "inline"bubble floats a button in a corner. inline fills an element on your page.Default: bubble
data-targetCSS selectorInline mode only: a CSS selector for the element the chat fills.Default: #daneshyar-widget
data-position"right" | "left"Bubble mode only: the corner the button sits in.Default: right
data-offsetinteger, 0–120Bubble mode only: the distance from the corner, in pixels.Default: 20
data-theme"auto" | "light" | "dark"auto follows the visitor's system setting.Default: auto
data-accent#rrggbbThe brand color for buttons and highlights. Use six hex digits.Default: #1a8b8b
data-titlestringThe text at the top of the chat.Default: empty (uses the built-in text)
data-subtitlestringThe smaller line under the title.Default: empty (uses the built-in text)
data-greetingstringThe first message visitors see.Default: empty (uses the built-in text)
data-launcher-labelstringText next to the button. Leave it out to show the button alone.Default: empty (uses the built-in text)
A value the widget does not understand is ignored and the default is used. For example, an offset of 500 becomes 20.

Bubble and inline

bubble (the default) adds a round button to a corner of the page. Clicking it opens a 400 × 640 px panel above the button. Escape closes it.

inline puts the chat inside an element on your page. By default it looks for #daneshyar-widget. You can change that with data-target. Give the element a height: if it has none, the widget uses 640px, and it never goes below 420px.

Inline mode
<div id="daneshyar-widget" style="height: 640px"></div>

<script
  src="https://app.daneshyar.info/widget.js"
  data-api-key="sk_9f3aC2xQ7mB1vT8sE4nK6pR0jY5wZ2hL"
  data-app-id="2d7c0e91-4a5b-4f8e-b3c6-9e1f0a7d5c42"
  data-workspace-id="8f14e45f-ceea-467a-9f4c-1a2b3c4d5e6f"
  data-mode="inline"
  async
></script>

On screens narrower than 480px, bubble mode opens full screen. You don't need to add anything for this.

PreviousEmbedded widgetNextFramework guides

On this page

  • Build your snippet
  • Required attributes
  • Optional attributes
  • Bubble and inline

Every example on this site runs against the live API. If one doesn't, tell us — that's a bug in the docs.

ServicesAboutTalk to us