<iframe> tag, using a <script> tag, or installing the Dify Chrome extension.
Click the Embed button on the WebApp card, copy the embed code, and paste it into the target location on your site.
Using the <iframe> Tag
Copy the <iframe> code into the element on your site where the AI application should appear, such as a <div> or <section>.
Using the <script> Tag
Copy the <script> code into your site’s <head> or <body> tag.This will display a Dify chatbot bubble button on your site. If you paste the
<script> code into the site’s <body>, you will get a full‑page AI chatbot.
Installing the Dify Chrome Extension
Follow the prompts to install the Dify Chatbot Chrome extension.Customizing the Dify Chatbot Bubble Button
When you embed the Dify chatbot bubble button (i.e., embedding via the<script> tag), you can customize the button’s style, position, and other settings.
The Dify chatbot bubble button can be customized with the following configuration options:
Overriding Default Button Styles
You can override the default button styles using CSS variables or thecontainerProps option, according to CSS specificity rules.
-
Modify CSS Variables
The following CSS variables are supported:
Example: change background color to
#ABCDEF: -
Use
containerPropsInline style:CSS class:
Passing inputs to the Embedded App
You can pass initial inputs to your embedded AI application. Four input types are supported:
text-input: Accepts any value; truncated if it exceeds the maximum length.paragraph: Similar totext-input; accepts any value and truncates if too long.number: Accepts a number or numeric string; strings are converted viaNumber.options: Accepts any value matching a pre‑configured option.
<iframe> or <script>.
Example: variable name with value apple.
Using the <iframe> Tag
For <iframe> embedding, append the parameter to the URL:
- GZIP‑compress the value.
- Base64‑encode it.
encodeURIComponentthe result.
apple:http://localhost/chatbot/{token}?name=H4sIAAAAAAAAA0ssKMhJBQBQ0C6pBQAAAA%3D%3D
Using the <script> Tag
For <script> embedding, pass inputs via the config: