DEF STUDIO srl

Incoming Data

Data obtained from manual polling or webhooks is available through a set of DTO, under the DefStudio\Telegraph\DTO\ namespace:

TelegramUpdate

contains incoming data (a message or a callback query)

  • ->id() incoming update_id
  • ->message() (optional) an instance of Message
  • ->callbackQuery() (optional) an instance of CallbackQuery

Chat

  • ->id() chat_id
  • ->type() the chat's type (private, group, supergroup or channel)
  • ->title() the chat's title

Message

  • ->id() incoming message_id
  • ->date() a CarbonInterface holding the message sent date
  • ->editDate() a CarbonInterface holding the message last edit date
  • ->text() the message text
  • ->protected() a boolean flag that states the message is protected from forwarding and download
  • ->from() (optional) an instance of User holding data about the message's sender
  • ->forwardedFrom() (optional) an instance of User holding data about a forwarded message's original sender
  • ->chat() (optional) an instance of Chat holding data about the chat to which the message belongs to
  • ->keyboard() (optional) an instance of DefStudio\Telegraph\Keyboard\Keyboard holding the message inline keyboard
  • ->replyToMessage() (optional) an instance of the original Message that the current message is replying
  • ->photos() (optional) a collection of Photo holding data about the contained image resolutions
  • ->animation() (optional) an instance of Photo holding data about the contained animation
  • ->audio() (optional) an instance of Audio holding data about the contained audio
  • ->document() (optional) an instance of Document holding data about the contained document
  • ->video() (optional) an instance of Video holding data about the contained video
  • ->location() (optional) an instance of Location holding data about the contained location
  • ->contact() (optional) an instance of Contact holding data about the contained contact data
  • ->voice() (optional) an instance of Voice holding data about the contained voical message
  • ->newChatMembers() a collection of User holding the list of users that joined the group/supergroup
  • ->leftChatMember() (optional) an instance of User holding data about the user that left the group/supergroup
  • ->webAppData() (optional) incoming data from sendData method of telegram WebApp

CallbackQuery

  • ->id() incoming callback_query_id
  • ->from() (optional) an instance of the User that triggered the callback query
  • ->message() (optional) an instance of the Message that triggered the callback query
  • ->data() an Illuminate\Support\Collection that holds the key/value pairs of the callback query data

User

  • ->id() user ID
  • ->isBot() marks if the user is a bot or a real user
  • ->firstName() user's first name
  • ->lastName() user's last name
  • ->userName() user's username

Audio

  • ->id() file ID
  • ->duration() audio duration
  • ->title() (optional) audio title
  • ->filename() (optional) audio file name
  • ->mimeType() (optional) audio MIME type
  • ->filesize() (optional) audio file size in Bytes
  • ->thumbnail() (optional) an instance of the Photo that holds data about the thumbnail

Animation

  • ->id() file ID
  • ->width() animation width
  • ->height() animation height
  • ->duration() animation duration
  • ->filename() (optional) animation file name
  • ->mimeType() (optional) animation MIME type
  • ->filesize() (optional) animation file size in Bytes
  • ->thumbnail() (optional) an instance of the Photo that holds data about the thumbnail

Document

  • ->id() file ID
  • ->filename() (optional) document file name
  • ->mimeType() (optional) document MIME type
  • ->filesize() (optional) document file size in Bytes
  • ->thumbnail() (optional) an instance of the Photo that holds data about the thumbnail

Photo

  • ->id() file ID
  • ->width() photo width
  • ->height() photo height
  • ->filesize() (optional) photo file size in Bytes

Video

  • ->id() file ID
  • ->width() video width
  • ->height() video height
  • ->duration() video duration
  • ->filename() (optional) video file name
  • ->mimeType() (optional) video MIME type
  • ->filesize() (optional) video file size in Bytes
  • ->thumbnail() (optional) an instance of the Photo that holds data about the thumbnail

Location

  • ->latitude() location latitude
  • ->longitude() location longitude
  • ->accuracy() (optional) location horizontal accuracy

Contact

  • ->phoneNumber() contact's phone number
  • ->firstName() contact's first name
  • ->lastName() (optional) contact's last name
  • ->userId() (optional) contact's telegram user ID
  • ->vcard() (optional) contact's vCard

Voice

  • ->id() file ID
  • ->duration() audio duration
  • ->mimeType() (optional) audio MIME type
  • ->filesize() (optional) audio file size in Bytes

InlineQuery

  • ->id() inline query id
  • ->query() the query typed by the user after the bot's name
  • ->from() an instance of User holding data about the user that started the query
  • ->offset() offset of the results to be returned, can be controlled by the bot
  • ->chat_type() type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat
  • ->location() (optional) an instance of Location containing sender location, only for bots that request user location.

InlineQueryResultGif

This is a DTO for outgoing data, wraps info about the Gif result returned to the user

InlineQueryResultPhoto

This is a DTO for outgoing data, wraps info about the Photo result returned to the user

InlineQueryResultContact

This is a DTO for outgoing data, wraps info about the Contact result returned to the user

InlineQueryResultArticle

This is a DTO for outgoing data, wraps info about the Article result returned to the user

InlineQueryResultMpeg4Gif

This is a DTO for outgoing data, wraps info about the Mpeg4Gif result returned to the user

InlineQueryResultVideo

This is a DTO for outgoing data, wraps info about the Video result returned to the user

InlineQueryResultAudio

This is a DTO for outgoing data, wraps info about the Audio result returned to the user

InlineQueryResultVoice

This is a DTO for outgoing data, wraps info about the Voice result returned to the user

InlineQueryResultDocument

This is a DTO for outgoing data, wraps info about the Document result returned to the user

InlineQueryResultLocation

This is a DTO for outgoing data, wraps info about the Location result returned to the user

Edit this page
Last updated 26 April 2024