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 ofMessage
-
->messageReaction()
(optional) an instance ofReaction
-
->callbackQuery()
(optional) an instance ofCallbackQuery
Chat
-
->id()
chat_id -
->type()
the chat's type (private, group, supergroup or channel) -
->title()
the chat's title
Message
-
->id()
incoming message_id -
->messageThreadId()
unique identifier of a message thread -
->date()
aCarbonInterface
holding the message sent date -
->editDate()
aCarbonInterface
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 ofUser
holding data about the message's sender -
->forwardedFrom()
(optional) an instance ofUser
holding data about a forwarded message's original sender -
->chat()
(optional) an instance ofChat
holding data about the chat to which the message belongs to -
->keyboard()
(optional) an instance ofDefStudio\Telegraph\Keyboard\Keyboard
holding the message inline keyboard -
->replyToMessage()
(optional) an instance of the originalMessage
that the current message is replying -
->photos()
(optional) a collection ofPhoto
holding data about the contained image resolutions -
->animation()
(optional) an instance ofPhoto
holding data about the contained animation -
->audio()
(optional) an instance ofAudio
holding data about the contained audio -
->document()
(optional) an instance ofDocument
holding data about the contained document -
->video()
(optional) an instance ofVideo
holding data about the contained video -
->location()
(optional) an instance ofLocation
holding data about the contained location -
->contact()
(optional) an instance ofContact
holding data about the contained contact data -
->voice()
(optional) an instance ofVoice
holding data about the contained voical message -
->sticker()
(optional) an instance ofSticker
holding data about the contained sticker -
->entities()
(optional) a collection ofEntity
holding data about the contained entity -
->newChatMembers()
a collection ofUser
holding the list of users that joined the group/supergroup -
->leftChatMember()
(optional) an instance ofUser
holding data about the user that left the group/supergroup -
->webAppData()
(optional) incoming data from sendData method of telegram WebApp -
->writeAccessAllowed()
(optional) an instance ofWriteAccessAllowed
holding data about the contained write access allowed data
CallbackQuery
-
->id()
incoming callback_query_id -
->from()
(optional) an instance of theUser
that triggered the callback query -
->message()
(optional) an instance of theMessage
that triggered the callback query -
->data()
anIlluminate\Support\Collection
that holds the key/value pairs of the callback query data
Reaction
-
->id()
incoming message_id -
->chat()
an instance ofChat
holding data about the chat to which the message belongs to -
->actorChat()
(optional) an instance ofChat
holding data about the chat to which the chat on behalf of which the reaction was changed, if the user is anonymous -
->from()
(optional) an instance ofUser
holding data about the message's sender -
->oldReaction()
a collection ofReactionType
holding data about the contained reaction type resolutions -
->newReaction()
a collection ofReactionType
holding data about the contained reaction type resolutions -
->date()
aCarbonInterface
holding the message sent
ReactionType
-
->type()
type of the reaction -
->emoji()
reaction emoji -
->customEmojiId()
(optional) custom emoji identifier
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 -
->languageCode()
user's language code -
->isPremium()
user's premium status
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 thePhoto
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 thePhoto
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 thePhoto
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 thePhoto
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
Sticker
-
->id()
file ID -
->type()
sticker type (consult https://core.telegram.org/bots/api#stickers for available types) -
->width()
sticker width -
->height()
sticker height -
->isAnimated()
true, if the sticker is animated -
->isVideo()
true, if the sticker is a video sticker -
->emoji()
(optional) emoji associated with the sticker -
->filesize()
(optional) sticker file size in Bytes -
->thumbnail()
(optional) an instance of thePhoto
that holds data about the thumbnail
Entity
-
->type()
type of the entity -
->offset()
offset in UTF-16 code units to the start of the entity -
->length()
length of the entity in utf-16 code units -
->url()
(optional) for “text_link” only, URL that will be opened after user taps on the text -
->user()
(optional) for “text_mention” only, the mentionedUser
-
->language()
(optional) for “pre” only, the programming language of the entity text -
->customEmojiId()
(optional) for “custom_emoji” only, unique identifier of the custom emoji
WriteAccessAllowed
-
->fromRequest()
true, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess -
->fromWebApp()
a helper method that returns true if the access was granted when the Web App was launched from a link -
->webAppName()
Name of the Web App, if the access was granted when the Web App was launched from a link -
->fromAttachmentMenu()
true, if the access was granted when the bot was added to the attachment or side menu -
->isAllowed()
true, if the user granted the bot write access to their account
InlineQuery
-
->id()
inline query id -
->query()
the query typed by the user after the bot's name -
->from()
an instance ofUser
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 ofLocation
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
ChatInviteLink
represents an invite link for a chat.
-
->inviteLink()
the invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…” -
->creator()
an instance ofUser
represents a creator of the link -
->createsJoinRequest()
true, if users joining the chat via the link need to be approved by chat administrators -
->isPrimary()
true, if the link is primary -
->isRevoked()
true, if the link is revoked -
->name()
(optional) invite link name -
->expireDate()
(optional) point in time (Unix timestamp) when the link will expire or has been expired -
->memberLimit()
(optional) The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 -
->pendingJoinRequestsCount()
(optional) number of pending join requests created using this link -
->subscriptionPeriod()
(optional) the number of seconds the subscription will be active for before the next payment -
->subscriptionPrice()
(optional) the amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link
ChatJoinRequest
represents a join request sent to a chat.
-
->chat()
an instance ofChat
to which the request was sent -
->from()
an instance ofUser
that sent the join request -
->userChatId()
identifier of a private chat with the user who sent the join request. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user. -
->date()
date the request was sent in Unix time -
->bio()
(optional) bio of the user -
->inviteLink()
(optional) an instance ofChatInviteLink
that was used by the user to send the join request