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->poll()(optional) an instance ofPoll->pollAnswer()(optional) an instance ofPollAnswer->callbackQuery()(optional) an instance ofCallbackQuery->preCheckoutQuery()(optional) an instance ofPreCheckoutQuery->chatMemberUpdate()(optional) a chat member's status was updated in a chat. An instance ofChatMemberUpdate->botChatStatusChange()(optional) the bot's chat member status was updated in a chat. An instance ofChatMemberUpdate
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()aCarbonInterfaceholding the message sent date->editDate()aCarbonInterfaceholding 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 ofUserholding data about the message's sender->forwardedFrom()(optional) an instance ofUserholding data about a forwarded message's original sender->chat()(optional) an instance ofChatholding data about the chat to which the message belongs to->keyboard()(optional) an instance ofDefStudio\Telegraph\Keyboard\Keyboardholding the message inline keyboard->replyToMessage()(optional) an instance of the originalMessagethat the current message is replying->photos()(optional) a collection ofPhotoholding data about the contained image resolutions->animation()(optional) an instance ofPhotoholding data about the contained animation->audio()(optional) an instance ofAudioholding data about the contained audio->document()(optional) an instance ofDocumentholding data about the contained document->video()(optional) an instance ofVideoholding data about the contained video->location()(optional) an instance ofLocationholding data about the contained location->contact()(optional) an instance ofContactholding data about the contained contact data->voice()(optional) an instance ofVoiceholding data about the contained voical message->sticker()(optional) an instance ofStickerholding data about the contained sticker->poll()(optional) an instance ofPollholding data about the contained poll->venue()(optional) an instance ofVenueholding data about the contained sticker->entities()(optional) a collection ofEntityholding data about the contained entity->invoice()(optional) an instance ofInvoiceholding data about the contained invoice->successfulPayment()(optional) an instance ofSuccessfulPaymentholding data about the successful payment with information about the payment->refundedPayment()(optional) an instance ofRefundedPaymentholding data about the refunded payment with information about the payment->newChatMembers()a collection ofUserholding the list of users that joined the group/supergroup->leftChatMember()(optional) an instance ofUserholding data about the user that left the group/supergroup->webAppData()(optional) incoming data from sendData method of telegram WebApp->writeAccessAllowed()(optional) an instance ofWriteAccessAllowedholding data about the contained write access allowed data->migrateToChatId()(optional) the group has been migrated to a supergroup with the specified identifier
CallbackQuery
->id()incoming callback_query_id->from()an instance of theUserthat triggered the callback query->message()(optional) an instance of theMessagethat triggered the callback query->data()anIlluminate\Support\Collectionthat holds the key/value pairs of the callback query data
PreCheckoutQuery
ore information on the payment page.
ChatMember
Represents a chat member that owns the chat and has all administrator privileges. For a complete list of privileges consult https://core.telegram.org/bots/api#chatmember
->status()the member's status in the chat->user()an instance of theUser->isAnonymous()true, if the user's presence in the chat is hidden->isMember()true, if the user is a member of the chat at the moment of the request->customTitle()(optional) custom title for this user->untilDate()(optional) date when the user's subscription will expire; OR: Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever
ChatMemberUpdate
The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user
->chat()an instance ofChatbetween User and Bot->from()an instance ofUserperformer of the action, which resulted in the change->date()date the change was done in Unix time->previous()previous information about the chat member->new()new information about the chat member
Reaction
->id()incoming message_id->chat()an instance ofChatholding data about the chat to which the message belongs to->actorChat()(optional) an instance ofChatholding 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 ofUserholding data about the message's sender->oldReaction()a collection ofReactionTypeholding data about the contained reaction type resolutions->newReaction()a collection ofReactionTypeholding data about the contained reaction type resolutions->date()aCarbonInterfaceholding 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
Invoice
More information on the payment page.
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 thePhotothat 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 thePhotothat 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 thePhotothat 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 thePhotothat 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 thePhotothat holds data about the thumbnail
Poll
->id()Poll ID->question()Poll question->questionEntities()(optional) a collection ofEntityholding data about the contained entity->options()a collection ofPollOptionholding data about the contained poll option->totalVoterCount()Total number of users that voted in the poll->isClosed()True, if the poll is closed->isAnonymous()True, if the poll is anonymous->type()Poll type->allowsMultipleAnswers()True, if the poll allows multiple answers
PollOption
->text()Option text->textEntities()(optional) a collection ofEntityholding data about the contained entity->voterCount()Number of users that voted for this option
Venue
->location()Venue location. Can't be a live location->title()Name of the venue->address()Address of the venue->foursquareId()(optional) Foursquare identifier of the venue->foursquareType()(optional) Foursquare type of the venue->googlePlaceId()(optional) Google Places identifier of the venue->googlePlaceType()(optional) Google Places type of the venue (consult https://developers.google.com/maps/documentation/places/web-service/supported_types)
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 ofUserholding 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 ofLocationcontaining 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
InlineQueryResultVenue
This is a DTO for outgoing data, wraps info about the Venue 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 ofUserrepresents 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 ofChatto which the request was sent->from()an instance ofUserthat 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 ofChatInviteLinkthat was used by the user to send the join request
PollAnswer
represents an answer of a user in a non-anonymous poll.
->pollId()poll identifier->voterChat()an instance ofChatthat changed the answer to the poll, if the voter is anonymous->user()an instance ofUserthat changed the answer to the poll, if the voter isn't anonymous->optionIds()0-based identifiers of chosen answer options. May be empty if the vote was retracted.
OrderInfo
represents information about an order. More information on the payment page.
ShippingAddress
represents a shipping address. More information on the payment page.
SuccessfulPayment
represents a successful payment. More information on the payment page.
RefundedPayment
represents a refunded payment. More information on the payment page.