Send Audio
Sends an audio file to a Telegram chat. Supports both local file paths and URLs, with options for captions, custom filenames, and MIME types.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Input
- Client Id - (Optional) The unique identifier for the bot client connection obtained from the Connect node. If not provided, you can use Bot Token instead.
- Chat Id - The target chat identifier where the audio will be sent. Can be:
- A user's Telegram ID (e.g.,
123456789) - A group chat ID (e.g.,
-987654321) - A channel ID (e.g.,
-1001234567890)
- A user's Telegram ID (e.g.,
- Audio Url or Path - The audio source. Can be:
- A local file path (e.g.,
C:\Music\song.mp3) - A URL to an audio file (e.g.,
https://example.com/audio.mp3)
- A local file path (e.g.,
Options
- Bot Token - (Optional) The Telegram bot token credential. This is an alternative to using Client Id - provide either Client Id OR Bot Token.
- Reply Id - (Optional) The message ID to reply to. If specified, the audio will be sent as a reply. Default:
0(no reply). - Caption - (Optional) Text caption for the audio file. Supports up to 1024 characters.
- File Name - (Optional) Override the filename that appears in Telegram. Leave empty to use the original filename.
- MIME Type - (Optional) Specify the MIME type of the audio file (e.g.,
audio/mpeg,audio/ogg). Leave empty to let Telegram detect automatically.
Output
- n/a - No output
How It Works
The Send Audio node uploads and sends an audio file to a specified Telegram chat. When executed, the node:
- Either uses the provided Client Id or creates a temporary connection using Bot Token
- Validates the Chat Id and Audio Url or Path
- Determines if the input is a URL or file path
- For URLs: Uses Telegram's FromURL method to send the file directly
- For file paths: Reads the local file and uploads it to Telegram
- Applies optional caption, custom filename, and MIME type if provided
- If Reply Id is provided, sends the audio as a reply to that message
- Returns success or error based on the API response
Requirements
- Either a valid Client Id from a Connect node OR a valid Bot Token credential
- A valid Chat Id where the bot has permission to send audio files
- For file paths:
- The file must exist and be readable
- Supported formats: MP3, M4A, OGG, WAV, FLAC, AAC
- Maximum file size: 50 MB
- For URLs:
- The URL must be publicly accessible
- Must point directly to an audio file
Error Handling
The node will return errors in the following cases:
- Empty or invalid Chat Id
- Empty or invalid Audio Url or Path
- File not found (for local paths)
- File too large (over 50 MB)
- Unsupported audio format
- URL not accessible or not pointing to an audio file
- Bot doesn't have permission to send files to the chat
- Network connectivity issues
- Telegram API errors
Usage Examples
Send Local Audio File:
Connect
→ Send Audio (
Chat Id: 123456789,
Audio Url or Path: "C:\Music\podcast.mp3"
)
→ Disconnect
Send Audio from URL:
Send Audio:
Chat Id: 123456789
Audio Url or Path: "https://example.com/music.mp3"
Caption: "Here's the audio you requested"
Send with Custom Filename:
Send Audio:
Chat Id: 123456789
Audio Url or Path: "/tmp/recording.ogg"
File Name: "Interview_2024_01_15.ogg"
Caption: "Interview recording"
Reply with Audio:
Receive Message
→ Send Audio (
Chat Id: message.chat.id,
Reply Id: message.message_id,
Audio Url or Path: "/path/to/response.mp3"
)
Supported Audio Formats
- MP3 - Most common, good compatibility (.mp3)
- M4A - AAC audio, good quality (.m4a)
- OGG - Vorbis/Opus codec (.ogg)
- WAV - Uncompressed, large files (.wav)
- FLAC - Lossless compression (.flac)
- AAC - Advanced Audio Coding (.aac)
Use Cases
Podcast Distribution:
Upload Podcast
→ Save as MP3
→ Send Audio (to subscribers channel)
Voice Message Archiving:
Receive Message (with voice)
→ Download File
→ Send Audio (to archive channel with metadata)
Music Bot:
Receive Message (song request)
→ Search Music Library
→ Send Audio (requested song)
Audio Reports:
Text to Speech (report content)
→ Save as Audio
→ Send Audio (to team channel)
Interview Recording Distribution:
Record Interview
→ Convert to MP3
→ Send Audio (to stakeholders with caption)
Best Practices
- Choose appropriate format - Use MP3 for music, OGG for voice
- Compress files - Keep under 10 MB when possible for faster uploads
- Add captions - Provide context about the audio content
- Use descriptive filenames - Help users identify content
- Specify MIME type - For better compatibility across clients
- Validate files - Check that files exist and are valid before sending
- Test audio playback - Verify audio plays correctly in Telegram
- Consider bitrate - 128-192 kbps is usually sufficient for voice
File Path Examples
Windows:
C:\Users\John\Music\podcast.mp3
D:\Recordings\interview.m4a
\\NetworkShare\Audio\music.mp3
Linux/Mac:
/home/user/music/song.mp3
/tmp/recording.ogg
~/Downloads/audio.mp3
MIME Type Examples
Common MIME types for audio:
audio/mpeg - MP3 files
audio/mp4 - M4A files
audio/ogg - OGG files
audio/wav - WAV files
audio/flac - FLAC files
audio/aac - AAC files
audio/x-m4a - M4A alternative
Caption Examples
Simple Caption:
"Podcast Episode 42: Building Telegram Bots"
Detailed Caption:
Title: Weekly Update
Date: January 15, 2024
Duration: 15:30
Host: John Doe
Common Patterns
Batch Audio Sending:
For Each (audioFile in playList)
→ Send Audio (
Chat Id: chatId,
Audio Url or Path: audioFile.path,
Caption: audioFile.title
)
→ Delay (2 seconds) // Avoid rate limits
Dynamic Filename:
let fileName = `Recording_${date}_${time}.mp3`;
// Use in File Name field
Audio Library Bot:
Receive Message
→ Parse Request
→ Search Library
→ If (found)
→ Send Audio (matching track)
→ Else
→ Send Message ("Not found")
Convert and Send:
Download Video
→ Extract Audio
→ Convert to MP3
→ Send Audio (to user)
Audio File Optimization
For Music:
- Format: MP3
- Bitrate: 192-320 kbps
- Sample rate: 44.1 kHz
For Voice/Podcasts:
- Format: MP3 or OGG
- Bitrate: 64-128 kbps
- Sample rate: 22.05 or 44.1 kHz
- Mono channel (saves space)
For Archival:
- Format: FLAC
- Full quality, lossless
- Larger file size
Telegram Audio Display
- Audio files show with a play button
- Displays filename and file size
- Shows duration if available in metadata
- Captions appear below the audio player
- Users can download the file
- Playback controls integrated in chat
Advanced Features
With Metadata: Telegram extracts and displays:
- Track title
- Artist name
- Album name
- Duration
- Artwork/thumbnail (if embedded)
Custom Filename Benefits:
- Better organization for users
- More descriptive than original filenames
- Helps with searchability
Troubleshooting
File Not Found:
- Verify the file path is correct and absolute
- Check file permissions
- Ensure the file hasn't been moved or deleted
Upload Fails:
- Check file size (must be under 50 MB)
- Verify audio format is supported
- Test with a smaller file
URL Not Working:
- Ensure URL is publicly accessible
- Check that URL points directly to audio file
- Try downloading the URL manually to verify
No Audio Playback:
- Verify the audio file is not corrupted
- Check the format is supported
- Test the file locally before sending
Wrong MIME Type:
- Let Telegram auto-detect (leave MIME Type empty)
- Or specify the correct MIME type for your format
- Check file extension matches content
Tips
- Audio files with metadata display better (artist, title, etc.)
- For voice recordings, consider using Send Voice node instead (not available in this package, use Send Audio)
- Telegram shows audio duration automatically if it's in the file metadata
- For URLs, Telegram downloads the file to its servers
- Local files are uploaded from your machine
- Audio files can be up to 50 MB (vs. 10 MB for photos)
- Users can download and save audio files from Telegram
- Consider converting video files to audio-only to save bandwidth
- MP3 is the most universally compatible format
- Add metadata to audio files before sending for better user experience