File Processing

The "File Processing" block allows you to retrieve information about files sent by the user, work with them within the bot scenario, and convert them to a different format using ffmpeg.


How to add the block

In the command editor, click "+ Add block"Bot category → select File Processing.


This action retrieves a direct download link for the file via the Telegram Bot API and saves the file's properties into a variable.

Fields

Field Default Description
Specify file ID FILE_ID The ID of the file sent by the user. By default, it uses the system macro FILE_ID, which automatically stores the file_id of the last file received from the user.
Save to variable file_data The name of the variable where the file properties will be saved.
Download file Off If enabled, the file is downloaded to the platform's server, and a local URL is saved to the variable. This is required for file conversion.

Result variables

After the action executes, three variables using dot notation become available:

Macro Value
file_data.url Direct download link for the file
file_data.type File type: photo, video, audio, or document
file_data.size File size in bytes

If you specified a different variable name (e.g., my_file), the macros will be my_file.url, my_file.type, and my_file.size. ---

"Download File" Mode

When the Download File option is enabled:

  1. The bot calls the Telegram API getFile method to retrieve the file path.
  2. The file is downloaded and saved to the platform server in the bot_files/{bot_id}/ folder.
  3. The address from our server is stored in file_data.url.

This is useful when:

  • You need a permanent link (Telegram links are temporary)
  • You need to convert the file to a different format
  • You need to embed the file in a message or send it via an external service

⏱ The link to the downloaded file is valid for 24 hours, after which the file is automatically deleted from the server.


File Conversion

This option is available only when "Download file" is enabled.

Check the "Convert file" box to automatically convert the downloaded file using ffmpeg.

Supported Formats

Group Formats
Audio OGA (Telegram voice), MP3, M4A, WAV, AAC
Video MP4, MOV, AVI, WebM
Image JPEG, PNG, WebP, GIF

For images, a virtual target format—Base64 (Data URL)—is also available; it encodes the image into a string and writes it directly to var.url. See the "Converting an Image to Base64" section below for details.

Compatibility Matrix

From \ To Audio Video Image
Audio
Video ✅ (extract audio track)
Image

Video → Audio conversion involves extracting the audio track from the video file (e.g., MP4 → MP3).

Selecting Formats

  • From format — select the source file format (use the format in which the file is received from Telegram). The list of target formats updates automatically based on the selected source.
  • To format — select the target format. Only formats compatible with the source format are displayed. ### Stop scenario on error

If this option is enabled, the bot will stop at the current step if a conversion error occurs, and you will receive a notification via Telegram. It is disabled by default: if an error occurs, the bot continues the scenario using the link to the original (unconverted) file.

In either case, you will receive a system notification if an error occurs.


Advanced conversion settings

Click the "Advanced settings" link to access extended parameters. All settings are optional; if none are specified, ffmpeg uses default values.

Audio Output

Parameter Description
Bitrate Audio stream rate: 64k, 96k, 128k (default), 192k, 256k, 320k
Sample Rate 8000, 16000, 22050, 44100, 48000 Hz. Default: source.
Channels Source / Mono / Stereo

Video Output

Parameter Description
Max Resolution Source / 640×360 / 1280×720 / 1920×1080
FPS Source / 24 / 30 / 60 frames per second
Video Codec Auto / H.264 (libx264) / H.265 (libx265) / VP9 (libvpx-vp9)
Quality (CRF) From 0 (maximum quality, large file) to 51 (minimum). Default: 23.

Image Output

Parameter Description
Width (px) Target width. Height scales proportionally if not specified.
Height (px) Target height. Width scales proportionally if not specified.
Compression Quality (1–100) For JPEG and WebP: 100 = maximum. Ignored for PNG.
Crop (WxH:X:Y) Crop the image. Format: 640x480:0:0 — size 640×480, starting coordinates (0, 0).

Storage of converted files

  • Converted files are saved in bot_files/{bot_id}/ with the prefix conv_ in the filename.
  • Files are automatically deleted after 24 hours (cleanup runs every hour).
  • The original downloaded file is deleted immediately after successful conversion.

Usage example: Voice message → MP3

  1. The user sends a voice message to the bot.
  2. Add a File Processing block → Get file link action.
  3. File ID field: FILE_ID, variable: voice_data.
  4. Enable "Download file" → enable "Convert file".
  5. Select: From format OGA (Telegram voice) → To format MP3.
  6. In the next Text block, insert:
code
Your voice message as MP3: {{voice_data.url}}

System Macro FILE_ID

FILE_ID is a system variable that is automatically populated with every new message from the user:

  • Photo → ID of the largest version
  • Video, audio, document, voice message, video note, animation (GIF), sticker → file_id of the media file

If the user sends a text message, FILE_ID does not change (it retains the last known value).


"Convert File" Action

A standalone action for converting a file that has already been downloaded. It accepts a local file URL (e.g., from the "Get File Link" action with the "Download file" option enabled), converts it using ffmpeg, and saves the result to a variable.

Important: The URL must point to a file stored on the platform's server. External links are not supported; the bot will return an error if an external link is provided.

Fields

Field Default Description
File Link Local file URL or a variable containing the URL. Must include the platform server address. Example: file_data.url
Save result to variable converted_file Name of the variable where the converted file's properties will be stored.
Stop scenario on error Off If enabled: the bot stops upon a conversion error, and you receive a notification. If disabled: the bot continues the scenario without modifying the result variable.
From format / To format mp3 → oga Conversion direction. Use the same formats as in the "Get File Link" action.
Additional settings Bitrate, sample rate, channels, codec, and other ffmpeg parameters.

After successful conversion, the following variables are available (using converted_file as an example):

Macro Value
converted_file.url Link to the converted file
converted_file.type File type: photo, video, audio, document
converted_file.size File size in bytes
converted_file.ext File extension (mp3, oga, jpg...)
converted_file.fileName File name with extension

⏱ The link to the converted file is valid for 24 hours, after which the file is automatically deleted from the server.

Special Behavior

  • Matching formats: If the "From format" and "To format" are identical, ffmpeg is not called, and the original URL is saved to the variable.
  • Incompatible formats: If conversion between the specified format groups is impossible (e.g., audio → video), an error will occur.
  • Format compatibility is the same as described in the "File Conversion" section above.

Converting Images to Base64 (Data URL)

A special Base64 (Data URL) format is available as a conversion target for images. Instead of creating a file on the server, the platform encodes the source image into a string like data:image/;base64,... and saves it to var.url. This is useful when you need to embed an image directly into HTML—for example, in an HTML page block or a message with markup.

Supported source formats: jpg, png, webp, gif.

Size limit: 5 MB. If the file exceeds this size, the conversion will fail (behavior depends on the "Abort scenario on error" checkbox).

Data saved to the result variable:

Macro Value
converted_file.url Full data:image/;base64,... string
converted_file.type photo
converted_file.ext base64
converted_file.size Size of the source file in bytes
converted_file.fileName Name of the source file

Example of HTML usage:

html
<img src="{{converted_file.url}}" alt="preview">

When Base64 is selected, the "Additional settings" section (width/height/quality/crop) is hidden, as it applies only to ffmpeg conversions. The file is not saved to disk; the link remains valid only as long as the variable exists within the dialog state.

Typical workflow

  1. "File Processing" block → "Get file link": file_id = FILE_ID, variable voice_data, enable "Download file" (do not enable conversion).
  2. "File Processing" block → "Convert file": link voice_data.url, variable mp3_data, convert from OGA (Telegram voice) to MP3.
  3. In the next block: Your MP3: mp3_data.url

This is useful when you need to perform multiple sequential conversions on a single file or use a URL obtained from another source (e.g., a database variable).


"Create Text Document" Action

Creates a text or code file — for example, a CSV report, a log file, a JSON export, or a subtitle file — and saves a link to it in a variable. The file is assembled directly from a template with variables, with no conversion step involved.

Fields

Field Default Description
File content The text content of the file. Supports {{...}} variables — you can insert the result of another block, user data, and so on.
File format TXT Choose from TXT, CSV, SRT, JSON, JS, Markdown, XML, YAML, HTML, CSS, SQL, LOG. Determines the resulting file's extension.
File name File name without an extension, supports variables. Auto-generated if left empty.
Encoding UTF-8 UTF-8 with BOM, Windows-1251, and KOI8-R are also available, for files intended for software that doesn't understand UTF-8.
Save result to variable document Name of the variable that will store the created file's properties.

Result variables

Macro Value
{{document.url}} Link to the file
{{document.size}} File size in bytes
{{document.format}} File format
{{document.fileName}} File name with extension

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.

The editor includes a "Test" button that creates the file immediately with the current settings and shows you the link, without having to run the bot.


"Extract Audio From Video" Action

Extracts the audio track from a local video file (e.g., obtained via the "Get file link" action with "Download file" enabled) and saves it as a separate audio file. You can trim just the part you need instead of the whole track.

Fields

Field Default Description
Video link Local link to the video file. External links are not supported.
Start Optional. The second to start the clip at — enter seconds (90) or a timecode like 00:01:30.
End / Duration Optional. Either the end point of the clip or its duration — toggled with a nearby checkbox.
Audio format MP3 MP3, WAV, OGG, M4A, AAC, Opus, FLAC.
Bitrate 192k Quality (and size) of the resulting audio file.
Artist Written into the audio file's "Artist" tag. Supports variables.
Track title Written into the audio file's "Title" tag. Supports variables.
Save result to variable audio Name of the variable for the result's properties.

Result variables

Macro Value
{{audio.url}} Link to the audio file
{{audio.size}} File size in bytes
{{audio.format}} Audio format
{{audio.artist}} Artist (if specified)
{{audio.title}} Track title (if specified)

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.

If both "Start" and "End" are left empty, the entire audio track is extracted.


"Merge Audio" Action

Joins several local audio files, one after another, into a single file — for example, to assemble a playlist or a sequence of voice replies.

Fields

Field Default Description
Audio file links 2 empty fields Local links to the audio files, in the order they should be joined. The "+ Add audio" button adds another field — up to 10 files.
Output format MP3 MP3, WAV, OGG, M4A, AAC, Opus, FLAC.
Normalize volume Off Brings all files to the same loudness level so there are no jarring volume jumps between them.
Silence between files (sec) 0 Adds a pause between adjacent files.
Advanced settings Bitrate, sample rate, channels (mono/stereo).
Save result to variable merged_audio Name of the variable for the result's properties.

Result variables

Macro Value
{{merged_audio.url}} Link to the resulting audio file
{{merged_audio.size}} File size in bytes
{{merged_audio.format}} Audio format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


"Replace/Overlay Audio in Video" Action

Changes a local video's audio track to a different audio file — either fully replacing it or overlaying the new audio on top of the original sound.

Fields

Field Default Description
Mode Replace "Replace" / "Overlay" toggle.
Video link Local link to the video.
Audio link Local link to the audio file.
Loop audio On If the audio is shorter than the video, it repeats until the video ends. If longer, it's trimmed to the video's length. The output always stops at the shorter of the two tracks.
Overlaid audio volume (%) 10 Overlay mode only — how loud the new track plays over the original.
Audio offset (sec) 0 Delay before the new audio starts, relative to the start of the video.
Video settings same as source Resolution and quality; if left blank, the video keeps its original quality with no re-encoding.
Save result to variable video Name of the variable for the result's properties.

Result variables

Macro Value
{{video.url}} Link to the resulting video
{{video.size}} File size in bytes
{{video.format}} Video format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


"Change Audio Speed" Action

Speeds up or slows down a local audio file.

Fields

Field Default Description
Audio link Local link to the audio file.
Speed 1.0 Speed multiplier from 0.25 (4x slower) to 4.0 (4x faster).
Preserve pitch On When enabled, the voice keeps the same pitch, just faster/slower. When disabled, pitch changes together with speed (the classic "chipmunk" effect when sped up, or a slowed-down/deep voice when slowed down).
Save result to variable speed_audio

Result variables

Macro Value
{{speed_audio.url}} Link to the processed file
{{speed_audio.size}} File size in bytes
{{speed_audio.format}} File format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


"Trim Audio/Video" Action

Cuts out the part you need from a local audio or video file, without changing the file's format.

Fields

Field Default Description
File link Local link to audio or video.
Start Optional. Seconds (90) or a timecode like 00:01:30.
End / Duration Optional. Either the end point or the clip's duration — toggled with a nearby checkbox.
Precise trim (re-encode) Off By default the trim is fast, but for video the start point may shift slightly to the nearest keyframe. Enable for frame-accurate trimming — slower, the file gets re-encoded.
Save result to variable trimmed_media

Result variables

Macro Value
{{trimmed_media.url}} Link to the trimmed file
{{trimmed_media.size}} File size in bytes
{{trimmed_media.format}} File format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


"Audio Volume and Dynamics" Action

Four independent volume-related settings that can be combined within a single action.

Fields

Field Default Description
Audio link
Set volume Off A multiplier (1.0 = no change, 2.0 = twice as loud) or a dB value (6dB).
Dynamic compression Off Smooths out sudden volume swings in the recording — useful for voice messages with uneven loudness.
Loudness normalization Off Brings the recording to a standard target loudness (LUFS, default −23 — broadcast standard).
Fade in/out Off Separate fields for fade-in and fade-out duration, in seconds.

Enable at least one of the four settings — they're applied together, in the order listed.

Result variables

Macro Value
{{audio_volume.url}} Link to the processed file
{{audio_volume.size}} File size in bytes
{{audio_volume.format}} File format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


"Audio Effects and Processing" Action

Up to eight audio effects, each toggled by its own checkbox and applied in a fixed order: noise reduction → bass boost → chorus → flanger → phaser → echo → reverb → telephone effect.

Available effects

Effect Settings Description
Noise reduction Removes background noise from the recording.
Bass boost Strength, 0–100% Boosts low frequencies.
Chorus Strength, 0–100% A "multi-voice" effect, as if several instruments/voices are playing at once.
Flanger Strength, 0–100% A metallic "swooshing" modulation effect.
Phaser Strength, 0–100% A soft "sweeping" phase-modulation effect.
Echo Input/output gain, delay (ms), decay Classic echo with full parameter control.
Reverb Simulates the sound of a room or hall.
Telephone effect Narrows the frequency range, like a phone call.

Enable at least one effect — you can combine as many as you like.

Result variables

Macro Value
{{processed_audio.url}} Link to the processed file
{{processed_audio.size}} File size in bytes
{{processed_audio.format}} File format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


"Audio Analysis and Metadata" Action

Reads technical information and existing tags from a local audio file — the file itself is not modified, and no new file is created.

Fields

Field Default Description
Audio link
Save result to variable audio_info

Result variables

Macro Value
{{audio_info.duration}} Duration in seconds
{{audio_info.bitrate}} Bitrate
{{audio_info.sample_rate}} Sample rate (Hz)
{{audio_info.channels}} Number of channels
{{audio_info.codec}} Codec
{{audio_info.size}} File size in bytes
{{audio_info.format}} Format
{{audio_info.title}} {{audio_info.artist}} {{audio_info.album}} {{audio_info.genre}} {{audio_info.track}} {{audio_info.date}} Existing tags (empty if the tag is absent)

"Add Cover Art to Audio" Action

Embeds an image as cover art into a local audio file — MP3, M4A, OGG, and FLAC are supported.

Fields

Field Default Description
Audio link
Image link JPG or PNG.
Save result to variable audio_with_cover

Result variables

Macro Value
{{audio_with_cover.url}} Link to the file with the cover art
{{audio_with_cover.size}} File size in bytes
{{audio_with_cover.format}} File format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


"Edit Audio Metadata" Action

Edits the tags (title, artist, album, etc.) of a local audio file.

Fields

Field Default Description
Audio link
Title / Artist / Album / Genre / Track number / Date Each field supports variables. Next to each field is a "Clear" checkbox: checking it removes the tag regardless of what's typed in the field. If a field is left empty and its checkbox isn't checked, the existing tag is left untouched.
Save result to variable audio_meta

Fill in at least one field, or check at least one "Clear" checkbox.

Result variables

Macro Value
{{audio_meta.url}} Link to the updated file
{{audio_meta.size}} File size in bytes
{{audio_meta.format}} File format

⏱ The file link is valid for 24 hours, after which the file is automatically deleted from the server.


Execution Status and Error Handling

Every action in the "File Processing" block — all 15, including the newer audio actions — always writes two additional service variables alongside its own result:

Macro Value
{{prefix.status}} success if the action completed successfully, or error if something went wrong
{{prefix.error_message}} The error text (empty when everything succeeded)

Here, prefix is the same variable name you entered in the "Save result to variable" field (or "Result prefix" for HTML → PDF/PNG).

This pairs well with a "Condition" block placed right after the "File Processing" block: check {{prefix.status}} == error, and if it matches, show the user an error message, route to a different part of the scenario, or send yourself a notification.

Example: after the "Extract audio from video" action with variable audio, add a "Condition" block checking {{audio.status}} equals error → on that branch, send the text "Couldn't process the video, please try a different file"; otherwise, continue the scenario as usual.