Skip to content

[BUG] MCQ/MTC newline causes chat widget to hang #935

@matKlju

Description

@matKlju

Bug description:
When a service contains newline characters inside Message To Client (MTC) or Multiple Choice Question (MCQ) blocks/ elements, the response does not appear in the chat widget.
The chat widget remains loading / hanging instead of displaying the response.

This prevents services that include formatted text (with line breaks) from completing normally.

Expected behavior:
Services support newline characters in Message To Client (Sõnum kliendile – MTC) and Multiple Choice Question (MCQ) messages.
The chat widget should correctly render responses containing newline characters and display the message/options without remaining in a loading or hanging state.

Screenshots:

Request: {method: POST, url: /backoffice/hbs/bot_responses_to_messages, params: {}, query: {}, body: {"data":{"authorLastName":"","chatId":"2e25f76e-74a7-4d66-a908-ffe094b2dd8a","botMessages":[{"text":"asd\n\nasd","recipient_id":"2e25f76e-74a7-4d66-a908-ffe094b2dd8a"}],"authorFirstName":"","created":"2026-03-04T13:31:30.101Z","authorTimestamp":"2026-03-04T13:31:30.101Z","authorId":"chatbot"}}} err: SyntaxError: Bad control character in string literal in JSON at position 77 at JSON.parse (<anonymous>) at /workspace/app/server.js:139:31 at ExpressHandlebars.<anonymous> (/workspace/app/node_modules/express-handlebars/dist/express-handlebars.js:301:25) at step (/workspace/app/node_modules/express-handlebars/dist/express-handlebars.js:49:23) at Object.next (/workspace/app/node_modules/express-handlebars/dist/express-handlebars.js:30:53) at fulfilled (/workspace/app/node_modules/express-handlebars/dist/express-handlebars.js:21:58) Response: {statusCode: 200, responseData: "{\"error\":\"There was an error executing /workspace/app/module/backoffice/hbs/bot_responses_to_messages.handlebars\"}"}

Additional information:

The issue appears when the service returns text containing newline characters, which seems to break the chat widget response rendering.

Metadata

Metadata

Labels

bugSomething isn't workingv3.2

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions