How do I set a variable to one many upstream values?
For example, I have a small telegram chatbot that supports multiple message formats.
If the message is text, the workflow is basic and the message is used to generate an AI response.
However, if the image is a photo, AI inspects the image first, then returns a summary which I want to use as the message body.
{
"chat_id": "{{ $('Telegram Trigger').last().json.message.chat.id }}",
"message": {{ JSON.stringify($('Analyze image').item.json.content[0].text || $('Telegram Trigger').last().json.message.text) }},
"date_human": "{{ ... }}",
"glossary": {{ JSON.stringify($('Load Glossary').last().json.data.value) }},
...
}
Note: I was hoping I could assign the message key to either the output of analyse image or the message text.
Please share your workflow
- n8n version: [email protected] (cloud)
- Database (default: SQLite): n/a
- n8n EXECUTIONS_PROCESS setting (default: own, main): n/a
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud

