I’m building a chat interface that connects to Claude’s API via API Connector. The chat works for 2-3 messages, then breaks. Claude loses all conversation history and starts fresh.
The Problem: After 2-3 exchanges, I get either:
-
“messages.X: all messages must have non-empty content” error
-
Blank screen with no response
-
Claude repeats its opening greeting (forgets entire conversation)
My Setup:
-
Storing conversation in a custom state (list of texts) on the page
-
Each message formatted as: {“role”: “user”, “content”: “message text”}
-
Passing to API as: chat’s Conversation join with “,”
-
Using :formatted as JSON-safe on content field
What I’ve Tried (all failed):
-
Format as text with JSON-safe
-
Manual find & replace for special characters
-
Toolbox JavaScript for escaping
-
Different quote/escape combinations
-
Storing in database instead of custom state
Root Cause (I believe): Claude’s responses contain newlines, quotes, and special characters. Bubble’s text manipulation can’t properly escape these for valid JSON, especially inside :format as text.
What I Need: Multi-turn conversation with system prompt (I’m building a guided interview that asks ~10 questions). Need Claude to remember the full conversation history.
Questions:
-
Has anyone successfully implemented multi-turn Claude chat with conversation history in Bubble?
-
Is there a plugin that properly handles the messages array with JSON escaping?
-
Any workarounds for the :format as text newline issue?
Thanks for any help!

