/youtube/audio/tg-bot
audio straight into your telegram bot
we send the audio to your bot and hand back a file_id, so your bot forwards a file it already owns instead of uploading one. 7 credits when we have the track cached, 15 when we have to fetch it first. send X-Return-File-Id: false to get channel_id and message_id instead.
parameters
| name | type | description | example |
|---|---|---|---|
| video_idrequired | string | youtube video id (not the full url) | vk6014HuxcE |
| bot_usernamerequired | string | your bot, with the @ | @your_bot |
every request carries X-Api-Key.
request
curl -X POST 'https://api.fastsaver.io/v1/youtube/audio/tg-bot' \
-H 'X-Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"video_id":"vk6014HuxcE","bot_username":"@your_bot"}'raw http
POST https://api.fastsaver.io/v1/youtube/audio/tg-bot
Content-Type: application/json
{
"video_id": "vk6014HuxcE",
"bot_username": "@bot_username"
}response
{
"ok": true,
"file_id": "CQACAgIAAxkDAAIVKWk..."
}what to do with the file_id
the audio is already sitting in your bot. file_id is telegram's own handle for it, so sendAudio delivers it without uploading anything - no bandwidth from you and no wait. a file_id only works for the bot that received the file, which is why we ask for bot_username: hand it to another bot and telegram answers wrong file identifier. reuse it as often as you like.
POST https://api.telegram.org/bot<your_bot_token>/sendAudio
Content-Type: application/json
{
"chat_id": 123456789,
"audio": "CQACAgIAAxkDAAIVKWk..."
}with X-Return-File-Id: false you get channel_id and message_id instead - pass those to copyMessage when you would rather forward the original message than send a fresh one.