Hello,
I’m currently developing a conversational agent on n8n, connected to Telegram, with the goal of receiving messages (text or voice) and automatically replying via the AI Agent node.
What works:
When I send a text message via Telegram:
- The message is successfully captured,
- It is passed to the
AI Agent
node, - The prompt is recognized (
{{ $json.message.text }}
), and the response is correctly sent back via Telegram.
Issue encountered:
When I send a voice message, I get the following error from the AI Agent
node:
Problem in node 'AI Agent'
No prompt specified
Details:
- The voice message is successfully downloaded using
Telegram -> Get File
. - The transcription is correctly performed using
OpenAI - Transcribe Recording
, and thetext
field is present in the output. - I use
{{ $json.text }}
in the Prompt (User Message) field of theAI Agent
node. - However, the
"No prompt specified"
error appears only with voice messages. - The
text
field is clearly visible in the output JSON of the previous node.
What I’ve tried:
- Added a
Switch
to handle text and voice messages separately. - Used
{{ $json.text }}
for voice and{{ $json.message.text }}
for text. - Added a
Set
node to unify both into a common field likeprompt = {{ $json.text }}
. - Set
"language": "fr"
in the transcription node to force French.
What I need:
I want the AI Agent
node to dynamically handle either case:
- Use
message.text
when the message is a text, - Use
text
(transcription result) when it’s a voice message, - And generate a response in both scenarios without triggering the
"No prompt specified"
error.
Any suggestions or working setups are welcome. Thanks in advance!
—Preformatted text