How to get binary data in the correct way?

Hi there! I can’t deal with binary data

My task is:

  • get voice message from Telegram bot
  • then transcribe it using OpenAI

The output with the voice message is:

1 option works correctly:
If these steps are going one by one, I use “data”, and get the result easily:


2 option drives me crazy:
I want to add a step to the workflow - I need to show a chat action in Telegram like “recording…” (for better user’s experience) . And I can’t get my audio file anymore.

Please, help me to write the correct field

One of the easiest options is to use a Merge node.
See this example:

Here I was able to download a file after receiving a chat message and then merged both in one single item.

Because they were merged, the image (binary data) was passed forward to the Upload File node.

Other options

  • Writing the file to the filesystem, using “Read/Write File” node and then retrieving the file before the upload.

  • Changing the environment variable N8N_DEFAULT_BINARY_DATA_MODE from default to filesystem, making all binary files get stored in the filesystem by default. See documentation here.

.
:point_right: If my reply answers your question, please remember to mark it as a solution.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.