Skip to content

sendVoiceNote

Sahri Riza Umami edited this page Jun 22, 2018 · 2 revisions

Send a voice note message.

sendVoiceNote(chat_id, reply_to_message_id, voice_note, caption, parse_mode, duration, waveform, disable_notification, from_background, reply_markup)
Field Type Description
chat_id int53 Target chat.
reply_to_message_id int53 Identifier of the message to reply to.
voice_note inputFile Video note to be sent.
caption string Photo caption; 0-200 characters.
parse_mode string Text parse mode.
duration int32 Duration of the voice, in seconds.
waveform bytes Waveform representation of the voice note, in 5-bit format @caption Voice note caption; 0-200 characters.
disable_notification Bool Pass true to disable notification for the message. Not supported in secret chats.
from_background Bool Pass true if the message is sent from the background.
reply_markup ReplyMarkup Markup for replying to the message; for bots only

Example

  • Reply message 16061038592 in chat 1234567890 with a voice note message using voice note's remote id. Add "TEST" caption formatted in HTML.

    sendVoiceNote(1234567890, 16061038592, 'AwADBQADDAADZ26TC3e99NmyQIi9Ag', '<b>TEST</b>', 'html')

    Response:

    {
      ["@type"] = "message",
      author_signature = "",
      can_be_deleted_for_all_users = true,
      can_be_deleted_only_for_self = false,
      can_be_edited = false,
      can_be_forwarded = true,
      chat_id = "1234567890",
      contains_unread_mention = false,
      content = {
        ["@type"] = "messageVoiceNote",
        caption = {
          ["@type"] = "formattedText",
          entities = {
            {
              ["@type"] = "textEntity",
              length = 4,
              offset = 0,
              type = {
                ["@type"] = "textEntityTypeBold"
              }
            }
          },
          text = "TEST"
        },
        is_listened = false,
        voice_note = {
          ["@type"] = "voiceNote",
          duration = 100,
          mime_type = "audio/ogg",
          voice = {
            ["@type"] = "file",
            expected_size = 3290808,
            id = 21,
            ["local"] = {
              ["@type"] = "localFile",
              can_be_deleted = false,
              can_be_downloaded = true,
              downloaded_prefix_size = 0,
              downloaded_size = 0,
              is_downloading_active = false,
              is_downloading_completed = false,
              path = ""
            },
            remote = {
              ["@type"] = "remoteFile",
              id = "AwADBQADDAADZ26TC3e99NmyQIi9Ag",
              is_uploading_active = false,
              is_uploading_completed = true,
              uploaded_size = 3290808
            },
            size = 3290808
          },
          waveform = ""
        }
      },
      date = 1529657663,
      edit_date = 0,
      id = "16061038601",
      is_channel_post = false,
      is_outgoing = true,
      media_album_id = "0",
      reply_to_message_id = "16061038592",
      sender_user_id = 55556666,
      sending_state = {
        ["@type"] = "messageSendingStatePending"
      },
      ttl = 0,
      ttl_expires_in = 0,
      via_bot_user_id = 0,
      views = 0
    }

Frequently Asked Questions
The Functions

Clone this wiki locally