Skip to content

Cannot load existing conversation using iframe or embed script (conversation_id ignored) #18749

Description

@amarczew

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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.

Dify version

1.3.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I'm injecting the script below to load an existing conversation_id, but the chat always starts as a new conversation, creating a new conversation_id, instead of loading the one I passed.

<script>
    window.difyChatbotConfig = {
        token: 'token',
        baseUrl: 'https://mydomain',
        systemVariables: {
            // user_id: '47433ef6-345b-4c0f-ac33-39e00de43e7d',
            conversation_id: 'e87a4c48-f72a-4150-92d7-3ba545791dee'
        },
    }
</script>

<!-- Chatbot Script -->
<script src="https://mydomain/embed.min.js" id="id" defer></script>

🧪 What I'm seeing

Even when I pass a valid conversation_id, a new conversation is started.
When I include a user_id, I can see in the network tab that the existing conversations for that user are correctly listed via:

GET /api/conversations?limit=100&pinned=false

However, when a message is sent (with the user_id present), the system still creates a new conversation_id, instead of continuing the one I specified.


✅ What I want to achieve

In my app’s dashboard, I need to load an existing conversation_id, which was previously created by an automated backend process via API.

Current flow:

  1. Front-end calls a backend endpoint that creates a new chat via API.
  2. This endpoint returns a conversation_id.
  3. The front-end should then load the chatbot using this specific conversation_id.

Initially, I tried using an <iframe>, but it didn’t work as expected. Then I moved to embed.min.js, but got the same issue — the conversation_id is ignored and a new one is always created.


🤔 Any idea what's going wrong?

If this is not an issue, would love any guidance on how to correctly inject and resume a conversation using a known conversation_id.

✔️ Expected Behavior

When providing a valid conversation_id via window.difyChatbotConfig, the chatbot should load and resume the existing conversation, instead of creating a new one.

If both user_id and conversation_id are provided:

  • The chat should continue exactly from the given conversation_id context.
  • No new conversation_id should be created unless explicitly requested.

❌ Actual Behavior

Even when a valid conversation_id is provided through window.difyChatbotConfig, the chatbot starts a new conversation every time it loads.

  • A new conversation_id is generated, ignoring the one passed.
  • If a user_id is provided, the API correctly fetches the list of existing conversations for that user (/api/conversations?...), but sending a message still creates a new conversation instead of continuing the specified one.

This breaks the expected behavior of resuming an existing conversation, and makes it impossible to preload or control chat history from the frontend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions