Skip to content

sendPhoto

Sahri Riza Umami edited this page Jun 12, 2018 · 3 revisions

Sends a photo message.

sendPhoto(chat_id, reply_to_message_id, photo, caption, parse_mode, added_sticker_file_ids, width, height, ttl, thumbnail, thumb_width, thumb_height, disable_notification, from_background, reply_markup, callback, data)
Field Type Description
chat_id int53 Chat to send message.
reply_to_message_id int53 Identifier of a message to reply to.
photo inputFile Photo to send.
caption string Photo caption; 0-200 characters.
parse_mode string Text parse mode.
added_sticker_file_ids vector File identifiers of the stickers added to the photo, if applicable.
width int32 Photo width.
height int32 Photo height.
thumbnail inputThumb Photo thumbnail to be sent, this is sent to the other party in secret chats only.
ttl int32 Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats.
disable_notification Bool Pass true, to disable notification about the message, doesn't works in secret chats
from_background Bool Pass true, if the message is sent from background
reply_markup ReplyMarkup Bots only. Markup for replying to message

Example

  • Send a photo by its unique ids which is 212, into chat 1234567890. Add "Memories..." string in italic as its caption.

    sendPhoto(1234567890, msg.id, 212, "_Memories..._", 'md')

    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"] = "messagePhoto",
        caption = {
          ["@type"] = "formattedText",
          entities = {
            {
              ["@type"] = "textEntity",
              length = 11,
              offset = 0,
              type = {
                ["@type"] = "textEntityTypeItalic"
              }
            }
          },
          text = "Memories..."
        },
        is_secret = false,
        photo = {
          ["@type"] = "photo",
          has_stickers = false,
          id = "6327864790411749389",
          sizes = {
            {
              ["@type"] = "photoSize",
              height = 0,
              photo = {
                ["@type"] = "file",
                expected_size = 14368,
                id = 212,
                ["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 = "AgADBQADDagxG4AX0VctG6bBbmVjhryo0zIABPJL_xp1Xjp18z8DAAEC",
                  is_uploading_active = false,
                  is_uploading_completed = true,
                  uploaded_size = 14368
                },
                size = 14368
              },
              type = "i",
              width = 0
            }
          }
        }
      },
      date = 1528829863,
      edit_date = 0,
      id = "15974006793",
      is_channel_post = false,
      is_outgoing = true,
      media_album_id = "0",
      reply_to_message_id = "15974006784",
      sender_user_id = 133780085,
      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