How Web App Embedding Works
When you publish an app in Dify, you get a web app URL. You can share this URL directly, or embed the same app into your website using these methods:Chat Bubble Widget
Your web app as a floating button—visitors click to open the full interface
Iframe Integration
Your web app embedded directly in page content—always visible and ready
JavaScript Control
Advanced embedding with custom styling and behavior control
Responsive Design
Same web app adapts automatically to any presentation format
All embedding methods use your published web app. Changes to your app configuration automatically apply everywhere it’s embedded.
Chat Bubble Widget
The chat bubble presents your web app as a floating button. Visitors click it to open your app in an overlay—keeping them on your page while accessing your AI features.Configuration Options
The chat bubble can be customized through thedifyChatbotConfig object:
1
Get your embed token
In your Dify app, go to Publish → Embed to find your unique token.
2
Add the script
Include the configuration and Dify’s embed script in your website’s HTML.
3
Customize appearance
Adjust the
containerProps to match your website’s design.4
Test functionality
Open your website and try the chat button to ensure everything works correctly.
Iframe Integration
Embed your web app directly into your page content. This displays your app as an integral part of your website:Why Use Iframe Embedding
- Always visible - Your web app is immediately accessible, not hidden behind a button
- Full functionality - Everything from your web app works identically in the iframe
- Page integration - Appears as native content, not an overlay
- Simple setup - Just HTML, no JavaScript configuration needed
Customization Options
Size and Position:Choosing Your Embedding Method
Customer Support Apps
Customer Support Apps
Chat bubble works best—stays out of the way until needed. The floating button lets visitors continue browsing while having quick access to help.
Form & Workflow Apps
Form & Workflow Apps
Iframe embed for dedicated pages where the app is the main content. Visitors see and use your app immediately without extra clicks.
Product Demonstrations
Product Demonstrations
Iframe embed on landing pages to let visitors try your AI capabilities instantly. No barriers between interest and engagement.
Multi-page Integration
Multi-page Integration
Chat bubble when you want the same app accessible across your entire site. One embed code provides access from every page.
Troubleshooting
Widget not appearing:- Verify your app token matches what’s shown in Dify’s Publish → Embed section
- Check that configuration loads before the embed script
- Look for JavaScript errors in browser console
- Confirm the web app URL includes your correct token
- Ensure your site allows iframe content (check Content Security Policy)
- Both your site and Dify app should use HTTPS
containerProps option. Apply these methods based on CSS specificity to achieve your desired customizations.
1.Modifying CSS Variables
The following CSS variables are supported for customization:2.Using containerProps
Set inline styles using the style attribute:
className attribute:
3. Passing inputs
There are four types of inputs supported:
text-input: Accepts any value. The input string will be truncated if its length exceeds the maximum allowed length.paragraph: Similar totext-input, it accepts any value and truncates the string if it’s longer than the maximum length.number: Accepts a number or a numerical string. If a string is provided, it will be converted to a number using theNumberfunction.options: Accepts any value, provided it matches one of the pre-configured options.
http://localhost/chatbot/{token}?name=H4sIAKUlmWYA%2FwWAIQ0AAACDsl7gLuiv2PQEUNAuqQUAAAA%3D