Unable to Pass Parameters When Embedding Dify Chat Interface via iframe #7536

Closed
opened 2026-02-21 18:21:05 -05:00 by yindo · 11 comments
Owner

Originally created by @TAXID911101087886396267 on GitHub (Jan 6, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Description:

I'm encountering an issue while embedding the Dify chat interface into my webpage using an iframe. Despite following the official documentation, I am unable to pass parameters, such as sys.user_id, to the chat interface.

Steps to Reproduce:

Embed the Dify chat interface into a webpage using the provided iframe code.

Attempt to pass parameters (e.g., sys.user_id) through the iframe's URL or via JavaScript configuration.

Observe that the parameters are not being recognized or utilized by the chat interface.

Expected Behavior:

The embedded chat interface should accept and process parameters passed through the iframe, allowing for dynamic customization based on the provided values.

Actual Behavior:

The parameters passed to the iframe are not being acknowledged, resulting in a static chat interface without the intended customizations.

Request:

Could you provide guidance on how to successfully pass parameters to the Dify chat interface when embedding it via an iframe? If this functionality is not currently supported, are there any recommended workarounds or plans to implement this feature in future releases?

2. Additional context or comments

I have reviewed the following resources but have not found a solution:

Embedding In Websites - Dify Documentation

Pass input parameters to iframe #5575

Can pass some params to iframe src after publish as a public chat #2841

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @TAXID911101087886396267 on GitHub (Jan 6, 2025). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. Description: I'm encountering an issue while embedding the Dify chat interface into my webpage using an iframe. Despite following the official documentation, I am unable to pass parameters, such as sys.user_id, to the chat interface. Steps to Reproduce: Embed the Dify chat interface into a webpage using the provided iframe code. Attempt to pass parameters (e.g., sys.user_id) through the iframe's URL or via JavaScript configuration. Observe that the parameters are not being recognized or utilized by the chat interface. Expected Behavior: The embedded chat interface should accept and process parameters passed through the iframe, allowing for dynamic customization based on the provided values. Actual Behavior: The parameters passed to the iframe are not being acknowledged, resulting in a static chat interface without the intended customizations. Request: Could you provide guidance on how to successfully pass parameters to the Dify chat interface when embedding it via an iframe? If this functionality is not currently supported, are there any recommended workarounds or plans to implement this feature in future releases? ### 2. Additional context or comments I have reviewed the following resources but have not found a solution: [Embedding In Websites - Dify Documentation](https://docs.dify.ai/guides/application-publishing/embedding-in-websites) [Pass input parameters to iframe #5575](https://github.com/langgenius/dify/issues/5575) [Can pass some params to iframe src after publish as a public chat #2841](https://github.com/langgenius/dify/issues/2841) ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo closed this issue 2026-02-21 18:21:05 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 6, 2025):

Hello @TAXID911101087886396267! I'm here to help you with any bugs, questions, or becoming a contributor. Let's tackle this together!

I found some similar discussions that might be relevant to your issue:

  1. Specify user id for the web app - This discussion is still open and might provide insights or solutions related to passing user-specific parameters.

  2. iframe Embedded Integration of Agent: Parameter Passing Failure - This is another open discussion that addresses issues with parameter passing in iframes.

Regarding the current method for passing parameters, the Dify documentation suggests using the inputs object in the window.difyChatbotConfig configuration. Parameters are processed by compressing them with GZIP and encoding them in base64 before appending them to the URL. Here's an example:

window.difyChatbotConfig = {
    inputs: {
        name: 'apple',
    },
}

The URL with processed input values will look like this:
http://localhost/chatbot/{token}?name=H4sIAKUlmWYA%2FwWAIQ0AAACDsl7gLuiv2PQEUNAuqQUAAAA%3D [1].

If this method is not working for you, it might be worth checking if there are any specific limitations or known issues mentioned in the documentation, although none were found in the current context. Additionally, you might want to explore alternative methods for dynamic customization, such as using CSS variables or containerProps for styling and configuration [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Jan 6, 2025): <!-- Greeting --> Hello @TAXID911101087886396267! I'm here to help you with any bugs, questions, or becoming a contributor. Let's tackle this together! <!-- Answer --> I found some similar discussions that might be relevant to your issue: 1. [Specify user id for the web app](https://github.com/langgenius/dify/discussions/8479) - This discussion is still open and might provide insights or solutions related to passing user-specific parameters. 2. [iframe Embedded Integration of Agent: Parameter Passing Failure](https://github.com/langgenius/dify/discussions/11486) - This is another open discussion that addresses issues with parameter passing in iframes. Regarding the current method for passing parameters, the Dify documentation suggests using the `inputs` object in the `window.difyChatbotConfig` configuration. Parameters are processed by compressing them with GZIP and encoding them in base64 before appending them to the URL. Here's an example: ```javascript window.difyChatbotConfig = { inputs: { name: 'apple', }, } ``` The URL with processed input values will look like this: `http://localhost/chatbot/{token}?name=H4sIAKUlmWYA%2FwWAIQ0AAACDsl7gLuiv2PQEUNAuqQUAAAA%3D` <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-publishing/embedding-in-websites.md)</sup>. If this method is not working for you, it might be worth checking if there are any specific limitations or known issues mentioned in the documentation, although none were found in the current context. Additionally, you might want to explore alternative methods for dynamic customization, such as using CSS variables or `containerProps` for styling and configuration <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-publishing/embedding-in-websites.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/261e7453-6df9-4fb9-9db7-20945b2d8b8c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/261e7453-6df9-4fb9-9db7-20945b2d8b8c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/261e7453-6df9-4fb9-9db7-20945b2d8b8c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/261e7453-6df9-4fb9-9db7-20945b2d8b8c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/261e7453-6df9-4fb9-9db7-20945b2d8b8c?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/261e7453-6df9-4fb9-9db7-20945b2d8b8c?feedback_type=other)</sup>
Author
Owner

@byrocuy commented on GitHub (Jan 19, 2025):

Any updates on this issue? I'm also experiencing it. I'm passing input values via window.difyChatbotConfig when initializing the iframe, but the input fields are still displayed at the start of iframe instead of being skipped

@byrocuy commented on GitHub (Jan 19, 2025): Any updates on this issue? I'm also experiencing it. I'm passing input values via `window.difyChatbotConfig` when initializing the iframe, but the input fields are still displayed at the start of iframe instead of being skipped
Author
Owner

@charli-polo commented on GitHub (Jan 31, 2025):

This is also a major roadblock for me.
As it is possible for the dify widget button it should be for the iframe UI.

@charli-polo commented on GitHub (Jan 31, 2025): This is also a major roadblock for me. As it is possible for the [dify widget button](https://docs.dify.ai/guides/application-publishing/embedding-in-websites) it should be for the iframe UI.
Author
Owner

@LiuYuLu commented on GitHub (Feb 11, 2025):

I'm also having the same issue. How to set the user ID by default instead of letting the user fill it in?

@LiuYuLu commented on GitHub (Feb 11, 2025): I'm also having the same issue. How to set the user ID by default instead of letting the user fill it in?
Author
Owner

@jiandanfeng commented on GitHub (Feb 21, 2025):

#11396

@jiandanfeng commented on GitHub (Feb 21, 2025): #11396
Author
Owner

@jiandanfeng commented on GitHub (Feb 21, 2025):

I don't know why it is not supported, what is the original intention of this design? I also need to pass the parameter sys.user_id

@jiandanfeng commented on GitHub (Feb 21, 2025): I don't know why it is not supported, what is the original intention of this design? I also need to pass the parameter sys.user_id
Author
Owner

@zy0606 commented on GitHub (Feb 24, 2025):

Has this been resolved? I'm experiencing the same problem.

@zy0606 commented on GitHub (Feb 24, 2025): Has this been resolved? I'm experiencing the same problem.
Author
Owner

@jaylu1993 commented on GitHub (Mar 3, 2025):

I also have the same problem and look forward to a solution.

@jaylu1993 commented on GitHub (Mar 3, 2025): I also have the same problem and look forward to a solution.
Author
Owner

@jimiopex commented on GitHub (Mar 3, 2025):

Same issue, Looking forward for a solution.

@jimiopex commented on GitHub (Mar 3, 2025): Same issue, Looking forward for a solution.
Author
Owner

@suntao2015005848 commented on GitHub (Mar 7, 2025):

+1

@suntao2015005848 commented on GitHub (Mar 7, 2025): +1
Author
Owner

@suntao2015005848 commented on GitHub (Mar 7, 2025):

#13903

@suntao2015005848 commented on GitHub (Mar 7, 2025): #13903
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7536