Help needed: API Integration error with voiceflow chatbot on second message transmission

Hello, everyone!

I’m facing an unexpected challenge with my Voiceflow chatbot’s API integration that has recently surfaced, and I’m hoping to find some guidance or solutions from this knowledgeable community.

The Problem: My setup involves making API calls through a Voiceflow chatbot, which initially worked flawlessly. For the first 10 attempts, both the first and subsequent API calls executed without a hitch, regardless of the message length. However, I’ve suddenly started encountering an error on the second API call when the message payload is relatively long. The error is as follows:

rubyCopy code

API call error - {"status":400,"data":{"error":{"message":"1 validation error for Request\nbody -> 135\n Invalid control character at: line 3 column 113 (char 135) (type=value_error.jsondecode; msg=Invalid control character at; doc={\n "role": "Kunde",\n "content": "På hvilke måder kan vi forbedre vores forståelse af kundeadfærd for at forbedre salgsstrategier?\n"\n }\n; pos=135; lineno=3; colno=113)","type":"invalid_request_error","param":null,"code":null},"VF_STATUS_CODE"...

This error, indicating an “Invalid control character” in the JSON payload, seems to only occur on the second message if it’s lengthy. The first 10 tries did not exhibit this issue, which makes the sudden appearance of this error even more perplexing.

Attempts to Resolve:

  • Validated JSON format externally to ensure correctness.
  • Noticed that shorter messages on the second API call do not trigger this error, hinting at a possible issue with how longer messages are handled or formatted.
  • This issue occurred out of nowhere after several successful attempts, leaving me puzzled about the underlying cause.


  1. Has anyone experienced a similar sudden issue with Voiceflow’s API integration, where longer messages on subsequent calls suddenly start causing errors?
  2. Are there any known changes or limitations in Voiceflow regarding JSON payload formatting for API calls that might lead to this issue after initial successful attempts?
  3. I welcome any debugging tips or solutions to handle longer messages in API calls without encountering JSON formatting errors. How can I ensure consistent success as initially experienced?

I’m eagerly awaiting your insights or any advice on tackling this sudden challenge. Your experience and knowledge could be invaluable in helping me navigate this issue.

Thank you all in advance for your help!