mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-07-22 04:15:24 -04:00
[DOCS]: How to access query param name from iframe src /chatbot/{token}?name=... in agent/workflow? #259
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @928996238 on GitHub (Nov 3, 2025).
Type of Documentation Change
Error/Typo fix
Documentation Page URL or Path
No response
Current Content
Docs show a URL example like:
http://localhost/chatbot/{token}?name=H4sIAAAAAAAAA0ssKMhJBQBQ0C6pBQAAAA%3D%3D
But the documentation does not explain:
How to access the name query parameter from the chatbot page / iframe
How to make the agent / workflow use this parameter
Whether the example value (e.g. H4sIA...) needs decoding/decompressing (looks like gzip+base64)
Suggested Changes
It would be helpful to add:
Code snippet for reading the query param:
const params = new URLSearchParams(window.location.search)
const name = params.get('name')
Recommended way to pass it into workflow:
As a Start Node input
Using {{name}} in tool calls or message template
Clarify iframe embedding method:
vs injecting via:
window.difyChatbotConfig = {
inputs: { name }
}
Guidance for decoding if compressed/encoded
Reason for Change
The current docs show a query param example but do not describe how to handle it.
Developers cannot use URL parameters in agents or workflows without additional guidance.
Adding practical examples will make the documentation complete and prevent integration issues.
Code of Conduct
@dosubot[bot] commented on GitHub (Nov 3, 2025):
Hi @928996238! I'm Dosu and I’m helping the dify-docs team.
To use a query parameter like name from the iframe src (e.g. /chatbot/{token}?name=...), you need to ensure the value is gzip-compressed and base64-encoded before adding it to the URL. The Dify frontend will automatically decode and decompress this value, making it available as an input to your workflow or agent. You can then reference it as a Start Node input or in templates using {{name}}.
If you use window.difyChatbotConfig.inputs = { name }, the encoding is handled for you and the parameter is injected into the iframe src as a compressed, encoded query param. If you manually construct the iframe src, you must encode the value yourself using gzip + base64 (see the compressAndEncodeBase64 function in the Dify embed.js) cite.
On the chatbot page, the frontend uses utility functions to decode and decompress these parameters and maps them to workflow inputs cite. You do not need to manually decode them in your workflow or agent logic.
Example for manual embedding:
Example for config-based embedding:
In your workflow or agent, reference the input as {{name}}.
If you need to implement gzip+base64 encoding in your own code, refer to the compressAndEncodeBase64 function in Dify's embed.js cite.
Best practice: use window.difyChatbotConfig.inputs when possible to avoid manual encoding. Only manually encode if you are constructing the iframe src yourself.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@928996238 commented on GitHub (Nov 3, 2025):
I configured difyChatbotConfig on my page like this:
{
"token": "9VqFjIir8lUWSEWD",
"inputs": { "name": "NAME111" },
"systemVariables": { "name": "NAME222" },
"userVariables": { "name": "NAME333" }
}
Then, in my workflow, when sending an HTTP request, I set a header value using:
{{name}}
However, in my testing, it seems this value is not being resolved to any of the above name fields. It always appears empty in the actual request.
I will attach screenshots showing the configuration and workflow setup.
Could you please help check what I might be doing wrong, or clarify which field (inputs, systemVariables, or userVariables) the workflow resolves when using {{name}}?
Thanks!
@dosubot[bot] commented on GitHub (Nov 3, 2025):
The workflow only resolves {{name}} if "name" is defined as an input variable in your app's Start Node (user_input_form). The difyChatbotConfig.inputs field provides default values for these workflow variables, but if "name" isn't defined in the Start Node, it won't be available in the workflow—even if you set it in inputs, systemVariables, or userVariables.
userVariables are for chat UI display (like avatar/name in the bubble), and systemVariables are for system-level fields (like sys.user_id), not general workflow variables. To fix this, add "name" as an input variable in your workflow's Start Node. Then {{name}} will resolve to the value from difyChatbotConfig.inputs["name"] (e.g., "NAME111") in your HTTP request header.
References:
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@928996238 commented on GitHub (Nov 3, 2025):
Hi team,
I have already followed your guidance and configured the variable name in the Agent orchestration. Then, when calling the tool API, I set the request header to {{name}}. However, it still doesn’t seem to take effect.
I’ve spent quite some time troubleshooting this, but I’m still unable to make it work. Could you please advise me on what else I should do?
Thank you very much for your help!
@dosubot[bot] commented on GitHub (Nov 3, 2025):
This is a known issue in Dify (especially v1.6.0 and some later versions): when you use a workflow as a tool in an agent, dynamic variables like
{{name}}are not resolved—they appear empty in the tool call, even if you’ve configured everything correctly in difyChatbotConfig and the agent orchestration. This is due to a gap between agent and workflow execution contexts, and is being actively worked on (details & PRs).Key points:
{{name}}in the workflow context—not userVariables or systemVariables (reference).{{name}}may not be passed through due to this bug (reference).What you can do:
nameis both in difyChatbotConfig.inputs and defined as a Start Node input in your workflow.If you need a temporary workaround, try calling the workflow directly (not as an agent tool) to confirm variable passing works in that context. If it does, the agent-tool bug is the root cause.
Let me know your Dify version if you want to check for a specific patch or workaround.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
