Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/grammy/mod.ts>Api#sendAudio

The Telegram Bot Framework.
Very Popular
Go to Latest
method Api.prototype.sendAudio
import { Api } from "https://deno.land/x/grammy@v1.31.1/mod.ts";

Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.

For sending voice messages, use the sendVoice method instead.

Parameters

chat_id: number | string

Unique identifier for the target chat or username of the target channel (in the format @channelusername)

audio: InputFile | string

Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data.

optional
other: Other<R, "sendAudio", "chat_id" | "audio">

Optional remaining parameters, confer the official reference below

optional
signal: AbortSignal

Optional AbortSignal to cancel the request

Official reference: https://core.telegram.org/bots/api#sendaudio