Chat
This object represents a chat.
π Schemaβ
Field | Type | Description |
---|---|---|
id | int | Unique identifier for this chat. 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 signed 64-bit integer or double-precision float type are safe for storing this identifier. |
type | string | Type of the chat, can be either βprivateβ, βgroupβ or βchannelβ |
title | string | Optional. Title, for channels and group chats |
username | string | Optional. Username, for private chats and channels if available |
first_name | string | Optional. First name of the other party in a private chat |
last_name | string | Optional. Last name of the other party in a private chat |
photo | ChatPhoto | Optional. Chat photo. Returned only in getChat. |
While the official Bale documentation mentions that the photo
field is returned only by getChat
, it is also possible to receive the photo
field in webhook updates. This means that even when the official docs state otherwise, the API can return the photo
in certain events.
βοΈ Get methodsβ
getId()β
Retrieves the ID of the chat.
$chatId = $chatObject->getId();
getType()β
Retrieves the type of the chat (e.g., "private", "group", "channel").
$chatType = $chatObject->getType();
getTitle()β
Retrieves the title of the chat (if available, typically for groups and channels).
$chatTitle = $chatObject->getTitle();
getUsername()β
Retrieves the username associated with the chat (if available, typically for private chats and channels).
$chatUsername = $chatObject->getUsername();
getFirstName()β
Retrieves the first name of the other party in the chat (if available, typically for private chats).
$userFirstName = $userObject->getFirstName();
getLastName()β
Retrieves the last name of the other party in the chat (if available).
$userLastName = $userObject->getLastName();
getPhoto()β
Retrieves the photo of the chat (if available). This can be accessed only for certain types of chats (e.g., group, channel).
$chatPhoto = $chatObject->getPhoto();
β Moreβ
For further information, refer to the official Bale documentation for more details.