AI response formatting issue on WhatsApp (WAHA)

I am using an AI Agent in n8n to generate text responses and sending them to WhatsApp via WAHA.
The workflow runs without errors, but the message formatting is incorrect in WhatsApp.

The AI output contains Markdown symbols (**, *, bullet points and line breaks).
When the message is sent to WhatsApp, the formatting breaks and the message is truncated,
showing a “LER mais” (Read more) button.

What is the error message (if any)?

There is no error message. The execution is successful, but the output format is wrong.

How can I remove Markdown from AI responses and send clean plain text to WhatsApp using WAHA?

you can use node code to clean it. you can use ai to make the code

1 Like

Thanks so much man! I will test it!

Hey @Joao_Pedro_Salomao !

You can expression either JSON.stringify, or replace, or both.. depends on your output format!

{{

JSON.stringify(

$json.text

  .replace(/\\\*\\\*/g, '\*')      // convert \*\*bold\*\* to \*bold\*

  .replace(/\\s+$/g, '')       // remove trailing whitespace/newlines

)

}}

Cheers!

1 Like

Where in the my workflow do i put this? Is it in de code node?

Share images if not the workflow… with the output of agent .

If is “output” , replace $json.text with $json.output .

Without more informations quite hard to guess your setup.