### Python Example: Send Message API Key Configuration Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md Illustrates the initial setup for sending messages using the `max_client` library in Python, specifically focusing on API key authorization. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' ``` -------------------------------- ### Python Example: Get Upload URL Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/UploadApi.md This Python example demonstrates how to configure the `max_client` API, set up API key authorization, and call the `get_upload_url` method to obtain a file upload URL. It includes basic error handling for API exceptions. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.UploadApi(max_client.ApiClient(configuration)) type = max_client.UploadType() # UploadType | Uploaded file type: photo, audio, video, file try: # Get upload URL api_response = api_instance.get_upload_url(type) pprint(api_response) except ApiException as e: print("Exception when calling UploadApi->get_upload_url: %s\n" % e) ``` -------------------------------- ### Python Example: Revoke Chat Admin Rights Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Illustrates how to revoke administrative rights from a user in a chat using the `max_client.ChatsApi` `delete_admins` method. The example includes API key setup, specifying chat and user IDs, and basic error handling. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier user_id = 56 # int | User identifier try: # Revoke admin rights api_response = api_instance.delete_admins(chat_id, user_id) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->delete_admins: %s\n" % e) ``` -------------------------------- ### Python Example: Get Video Attachment Details Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md Demonstrates how to use the `max_client` library in Python to retrieve details for a video attachment using its token. Includes API key configuration and error handling. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.MessagesApi(max_client.ApiClient(configuration)) video_token = 'video_token_example' # str | Video attachment token try: # Get video details api_response = api_instance.get_video_attachment_details(video_token) pprint(api_response) except ApiException as e: print("Exception when calling MessagesApi->get_video_attachment_details: %s\n" % e) ``` -------------------------------- ### Python Example for Answering on Callback with max_client.MessagesApi Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md This Python example demonstrates how to use the 'answer_on_callback' method to respond after a user clicks a button. It configures API key authorization and handles potential API exceptions. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.MessagesApi(max_client.ApiClient(configuration)) callback_id = 'callback_id_example' # str | Identifies a button clicked by user. Bot receives this identifier after user pressed button as part of `MessageCallbackUpdate` callback_answer = max_client.CallbackAnswer() # CallbackAnswer | try: # Answer on callback api_response = api_instance.answer_on_callback(callback_id, callback_answer) pprint(api_response) except ApiException as e: print("Exception when calling MessagesApi->answer_on_callback: %s\n" % e) ``` -------------------------------- ### Manage Bot Information: Retrieve Current Bot Profile Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/BotsApi.md This section provides documentation and examples for retrieving the current bot's profile. It includes a Python client example for fetching bot details and a detailed API specification for the `GET /me` endpoint. The bot is identified by the access token. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.BotsApi(max_client.ApiClient(configuration)) try: # Get current bot info api_response = api_instance.get_my_info() pprint(api_response) except ApiException as e: print("Exception when calling BotsApi->get_my_info: %s\n" % e) ``` ```APIDOC Method: get_my_info HTTP Request: GET /me Description: Get current bot info. Returns info about current bot. Current bot can be identified by access token. Method returns bot identifier, name and avatar (if any). Parameters: This endpoint does not need any parameter. Return Type: BotInfo Authorization: access_token HTTP Request Headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### Python Example: Add Members to Chat Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Demonstrates how to add members to a chat using the `max_client.ChatsApi` `add_members` method. This example shows API key configuration, setting chat and user identifiers, and handling potential API exceptions. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier user_ids_list = max_client.UserIdsList() # UserIdsList | try: # Add members api_response = api_instance.add_members(chat_id, user_ids_list) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->add_members: %s\n" % e) ``` -------------------------------- ### Python Example: Retrieve Bot Subscriptions Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/SubscriptionsApi.md This Python code snippet demonstrates how to initialize the `SubscriptionsApi` client, configure API key authorization, and call the `get_subscriptions` method to retrieve bot subscriptions. It includes error handling for API exceptions. ```Python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.SubscriptionsApi(max_client.ApiClient(configuration)) try: # Get subscriptions api_response = api_instance.get_subscriptions() pprint(api_response) except ApiException as e: print("Exception when calling SubscriptionsApi->get_subscriptions: %s\n" % e) ``` -------------------------------- ### Get Chat Members (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Demonstrates how to retrieve a list of users participating in a specific chat. This example sets up API key authentication. Note: The provided code snippet is incomplete. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' ``` ```APIDOC Method: get_members Description: Get members Returns users participated in chat. Parameters: chat_id: Type: int user_ids: Type: list of int Notes: optional marker: Type: int Notes: optional count: Type: int Notes: optional Return Type: ChatMembersList Authorization: access_token HTTP Request Headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### Retrieve Chat Information by Public Link or Username (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Shows how to obtain chat or channel details using a public link or a user's username. The example includes API key setup and error handling. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_link = 'chat_link_example' # str | Public chat link or username try: # Get chat by link api_response = api_instance.get_chat_by_link(chat_link) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->get_chat_by_link: %s\n" % e) ``` ```APIDOC Method: get_chat_by_link Description: Get chat by link Returns chat/channel information by its public link or dialog with user by username Parameters: chat_link: Type: str Description: Public chat link or username Return Type: Chat Authorization: access_token HTTP Request Headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### Get Chat Information using Max Bot API Client (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example demonstrates how to retrieve detailed information about a specific chat using the Max Bot API. It outlines the process of configuring API key authorization, instantiating the API client, and invoking the `get_chat` method with a `chat_id`. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint ``` -------------------------------- ### Python Example for Editing a Message with max_client.MessagesApi Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md This Python example demonstrates how to use the 'edit_message' method to update an existing message. It configures API key authorization and handles potential API exceptions. The example is incomplete. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint ``` -------------------------------- ### Python Example: Fetch Bot Updates via Long Polling Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/SubscriptionsApi.md This Python code demonstrates how to use the `get_updates` method for bots not using WebHooks, setting up parameters like `limit`, `timeout`, `marker`, and `types`. It shows how to configure API key authorization and handle potential API exceptions. ```Python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.SubscriptionsApi(max_client.ApiClient(configuration)) limit = 100 # int | Maximum number of updates to be retrieved (optional) (default to 100) timeout = 30 # int | Timeout in seconds for long polling (optional) (default to 30) marker = 56 # int | Pass `null` to get updates you didn't get yet (optional) types = types=message_created,message_callback # list[str] | Comma separated list of update types your bot want to receive (optional) try: # Get updates api_response = api_instance.get_updates(limit=limit, timeout=timeout, marker=marker, types=types) pprint(api_response) except ApiException as e: print("Exception when calling SubscriptionsApi->get_updates: %s\n" % e) ``` -------------------------------- ### Manage Bot Information: Edit Current Bot Profile Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/BotsApi.md This section provides documentation and examples for editing the current bot's profile. It includes a Python client example for updating bot details and a detailed API specification for the `PATCH /me` endpoint. Only specified fields in the `BotPatch` object will be updated. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.BotsApi(max_client.ApiClient(configuration)) bot_patch = max_client.BotPatch() # BotPatch | try: # Edit current bot info api_response = api_instance.edit_my_info(bot_patch) pprint(api_response) except ApiException as e: print("Exception when calling BotsApi->edit_my_info: %s\n" % e) ``` ```APIDOC Method: edit_my_info HTTP Request: PATCH /me Description: Edit current bot info. Edits current bot info. Fill only the fields you want to update. All remaining fields will stay untouched. Parameters: bot_patch: Type: BotPatch Description: (No description provided in source) Notes: (No notes provided in source) Return Type: BotInfo Authorization: access_token HTTP Request Headers: Content-Type: application/json Accept: application/json ``` -------------------------------- ### Get a Specific Chat by ID (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Demonstrates how to retrieve information for a specific chat using its unique identifier. This example configures API key authentication and handles potential API exceptions. ```python # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Requested chat identifier try: # Get chat api_response = api_instance.get_chat(chat_id) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->get_chat: %s\n" % e) ``` ```APIDOC Method: get_chat Description: Get chat Parameters: chat_id: Type: int Description: Requested chat identifier Return Type: Chat Authorization: access_token HTTP Request Headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### API Reference: Send Message Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md Details the API for sending messages to a chat, including a comprehensive guide on attaching media (video, audio, etc.) through a three-step process: obtaining upload URL, uploading binary, and sending the message with the attachment payload. Highlights important notices regarding file processing time. ```APIDOC Method: send_message Description: Sends a message to a chat. As a result for this method new message identifier returns. Parameters: new_message_body: (required) user_id: (optional) chat_id: (optional) disable_link_preview: (optional) Attaching media: Attaching media to messages is a three-step process. At first step, you should obtain a URL to upload your media files. At the second, you should upload binary of appropriate format to URL you obtained at the previous step. Finally, if the upload process was successful, you will receive JSON-object in a response body. Use this object to create attachment. Construct an object with two properties: - `type` with the value set to appropriate media type - and `payload` filled with the JSON you've got. For example, you can attach a video to message this way: 1. Get URL to upload. Execute following: curl -X POST 'https://botapi.max.ru/uploads?access_token=%access_token%&type=video' As the result it will return URL for the next step. { "url": "http://vu.mycdn.me/upload.do…" } 2. Use this url to upload your binary: curl -i -X POST -H "Content-Type: multipart/form-data" -F "data=@movie.mp4" "http://vu.mycdn.me/upload.do…" As the result it will return JSON you can attach to message: { "token": "_3Rarhcf1PtlMXy8jpgie8Ai_KARnVFYNQTtmIRWNh4" } 3. Send message with attach: { "text": "Message with video", "attachments": [ { "type": "video", "payload": { "token": "_3Rarhcf1PtlMXy8jpgie8Ai_KARnVFYNQTtmIRWNh4" } } ] } Important notice: It may take time for the server to process your file (audio/video or any binary). While a file is not processed you can't attach it. It means the last step will fail with `400` error. Try to send a message again until you'll get a successful result. Return type: SendMessageResult Authorization: access_token HTTP request headers: Content-Type: application/json Accept: application/json ``` -------------------------------- ### Set Chat Administrators using Max Bot API Python Client Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example demonstrates how to set administrators for a chat using the `ChatsApi` from the `max_client` Python library. It requires an API key, a chat identifier, and a `ChatAdminsList` object. The method returns true if all administrators are successfully added. Errors are caught as `ApiException`. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier chat_admins_list = max_client.ChatAdminsList() # ChatAdminsList | try: # Set chat admins api_response = api_instance.post_admins(chat_id, chat_admins_list) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->post_admins: %s\n" % e) ``` ```APIDOC Method: post_admins Description: Returns true if all administrators added. Parameters: chat_id: int (Chat identifier) chat_admins_list: ChatAdminsList Return Type: SimpleQueryResult Authorization: access_token HTTP Request Headers: Content-Type: application/json Accept: application/json ``` -------------------------------- ### Get Chat Members using Max Messenger Bot API Client (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Demonstrates how to retrieve a list of members for a specific chat using the `get_members` method of the `ChatsApi` client. It shows how to initialize the API client, set chat and user IDs, and handle potential API exceptions. ```python # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier user_ids = [56] # list[int] | *Since* version [0.1.4](#section/About/Changelog). Comma-separated list of users identifiers to get their membership. When this parameter is passed, both `count` and `marker` are ignored (optional) marker = 56 # int | Marker (optional) count = 20 # int | Count (optional) (default to 20) try: # Get members api_response = api_instance.get_members(chat_id, user_ids=user_ids, marker=marker, count=count) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->get_members: %s\n" % e) ``` -------------------------------- ### Get Chat Administrators using Max Bot API Client (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example demonstrates how to retrieve a list of all chat administrators for a given chat ID using the Max Bot API. It highlights the prerequisite that the bot must be an administrator in the requested chat. The snippet covers API key configuration, API instance creation, and calling the `get_admins` method, with error handling. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier try: # Get chat admins api_response = api_instance.get_admins(chat_id) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->get_admins: %s\n" % e) ``` -------------------------------- ### API Reference: Get Subscriptions Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/SubscriptionsApi.md Detailed API documentation for the `get_subscriptions` method, which retrieves a list of all active bot subscriptions when using WebHooks. It specifies return types, authorization requirements, and accepted content types. ```APIDOC Method: get_subscriptions Return type: GetSubscriptionsResult Parameters: None Authorization: access_token HTTP request headers: Content-Type: Not defined Accept: application/json Description: In case your bot gets data via WebHook, the method returns list of all subscriptions ``` -------------------------------- ### Python Example for Deleting a Message with max_client.MessagesApi Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md This Python example demonstrates how to use the 'delete_message' method to remove a message from a dialog or chat. It configures API key authorization and handles potential API exceptions. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.MessagesApi(max_client.ApiClient(configuration)) message_id = 'message_id_example' # str | Deleting message identifier try: # Delete message api_response = api_instance.delete_message(message_id) pprint(api_response) except ApiException as e: print("Exception when calling MessagesApi->delete_message: %s\n" % e) ``` -------------------------------- ### Edit Chat Information using Max Bot API Client (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example demonstrates how to edit chat information such as title and icon using the Max Bot API. It shows how to configure API key authorization, create an API instance, and call the `edit_chat` method with a `chat_id` and a `ChatPatch` object. Error handling for API exceptions is also included. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier chat_patch = max_client.ChatPatch() # ChatPatch | try: # Edit chat info api_response = api_instance.edit_chat(chat_id, chat_patch) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->edit_chat: %s\n" % e) ``` -------------------------------- ### API Reference: Get Video Attachment Details Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md Provides detailed information about a video attachment, including playback URLs and additional metadata, given a video token. ```APIDOC Method: get_video_attachment_details Description: Returns detailed information about video attachment: playback URLs and additional metadata. Parameters: Name Type Description Notes video_token str Video attachment token Return type: VideoAttachmentDetails Authorization: access_token HTTP request headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### Get Bot's Chat Membership using Max Messenger Bot API Client (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Illustrates how to fetch the current bot's membership information for a given chat using the `get_membership` method. It includes API key configuration and error handling. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier try: # Get chat membership api_response = api_instance.get_membership(chat_id) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->get_membership: %s\n" % e) ``` -------------------------------- ### MarkupElement Properties Definition Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MarkupElement.md Defines the structure and properties of a MarkupElement object, including its type, starting position, and length. This element is used to apply various text formatting styles or represent special entities like user mentions within a text. ```APIDOC MarkupElement: Properties: type: str Description: Type of the markup element. Can be strong, emphasized, strikethrough, underline, monospaced, link or user_mention _from: int Description: Element start index (zero-based) in text length: int Description: Length of the markup element ``` -------------------------------- ### API Reference: Get Updates (Long Polling) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/SubscriptionsApi.md Detailed API documentation for the `get_updates` method, designed for bots not subscribed to WebHooks, using long polling. It explains how to retrieve updates, manage sequence numbers with the `marker` parameter, and lists all supported parameters with their types and descriptions. ```APIDOC Method: get_updates Return type: UpdateList Parameters: Name: limit Type: int Description: Maximum number of updates to be retrieved Notes: optional, default to 100 Name: timeout Type: int Description: Timeout in seconds for long polling Notes: optional, default to 30 Name: marker Type: int Description: Pass `null` to get updates you didn't get yet Notes: optional Name: types Type: list[str] Description: Comma separated list of update types your bot want to receive Notes: optional Authorization: access_token HTTP request headers: Content-Type: Not defined Accept: application/json Description: You can use this method for getting updates in case your bot is not subscribed to WebHook. The method is based on long polling. Every update has its own sequence number. `marker` property in response points to the next upcoming update. All previous updates are considered as *committed* after passing `marker` parameter. If `marker` parameter is **not passed**, your bot will get all updates happened after the last commitment. ``` -------------------------------- ### Leave Chat using Max Bot API Python Client Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example demonstrates how to leave a chat using the `ChatsApi` from the `max_client` Python library. It requires an API key for authorization and takes a chat identifier as input. The API response is printed upon success, or an `ApiException` is caught and printed if an error occurs. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier try: # Leave chat api_response = api_instance.leave_chat(chat_id) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->leave_chat: %s\n" % e) ``` ```APIDOC Method: leave_chat Description: Leave chat Parameters: chat_id: int (Chat identifier) Return Type: SimpleQueryResult Authorization: access_token HTTP Request Headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### Pin Message in Chat using Max Bot API Python Client Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example shows how to pin a message in a specified chat or channel using the `ChatsApi` from the `max_client` Python library. It requires an API key, a chat identifier, and a `PinMessageBody` object. The API response is printed, and `ApiException` is handled for errors. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier where message should be pinned pin_message_body = max_client.PinMessageBody() # PinMessageBody | try: # Pin message api_response = api_instance.pin_message(chat_id, pin_message_body) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->pin_message: %s\n" % e) ``` ```APIDOC Method: pin_message Description: Pins message in chat or channel. Parameters: chat_id: int (Chat identifier where message should be pinned) pin_message_body: PinMessageBody Return Type: SimpleQueryResult Authorization: access_token HTTP Request Headers: Content-Type: application/json Accept: application/json ``` -------------------------------- ### SubscriptionsApi Method Overview Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/SubscriptionsApi.md A summary table listing all available methods within the `SubscriptionsApi` class, including their HTTP request types and brief descriptions. ```APIDOC Method | HTTP request | Description ------------- | ------------- | ------------- [**get_subscriptions**](SubscriptionsApi.md#get_subscriptions) | **GET** /subscriptions | Get subscriptions [**get_updates**](SubscriptionsApi.md#get_updates) | **GET** /updates | Get updates [**subscribe**](SubscriptionsApi.md#subscribe) | **POST** /subscriptions | Subscribe [**unsubscribe**](SubscriptionsApi.md#unsubscribe) | **DELETE** /subscriptions | Unsubscribe ``` -------------------------------- ### ChatsApi Methods Overview Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Overview of all available methods in the `max_client.ChatsApi` for managing chat operations, including their HTTP request details and descriptions. ```APIDOC Method | HTTP request | Description ------------- | ------------- | ------------- [**add_members**](ChatsApi.md#add_members) | **POST** /chats/{chatId}/members | Add members [**delete_admins**](ChatsApi.md#delete_admins) | **DELETE** /chats/{chatId}/members/admins/{userId} | Revoke admin rights [**delete_chat**](ChatsApi.md#delete_chat) | **DELETE** /chats/{chatId} | Delete chat [**edit_chat**](ChatsApi.md#edit_chat) | **PATCH** /chats/{chatId} | Edit chat info [**get_admins**](ChatsApi.md#get_admins) | **GET** /chats/{chatId}/members/admins | Get chat admins [**get_chat**](ChatsApi.md#get_chat) | **GET** /chats/{chatId} | Get chat [**get_chat_by_link**](ChatsApi.md#get_chat_by_link) | **GET** /chats/{chatLink} | Get chat by link [**get_chats**](ChatsApi.md#get_chats) | **GET** /chats | Get all chats [**get_members**](ChatsApi.md#get_members) | **GET** /chats/{chatId}/members | Get members [**get_membership**](ChatsApi.md#get_membership) | **GET** /chats/{chatId}/members/me | Get chat membership [**get_pinned_message**](ChatsApi.md#get_pinned_message) | **GET** /chats/{chatId}/pin | Get pinned message [**leave_chat**](ChatsApi.md#leave_chat) | **DELETE** /chats/{chatId}/members/me | Leave chat [**pin_message**](ChatsApi.md#pin_message) | **PUT** /chats/{chatId}/pin | Pin message [**post_admins**](ChatsApi.md#post_admins) | **POST** /chats/{chatId}/members/admins | Set chat admins [**remove_member**](ChatsApi.md#remove_member) | **DELETE** /chats/{chatId}/members | Remove member [**send_action**](ChatsApi.md#send_action) | **POST** /chats/{chatId}/actions | Send action [**unpin_message**](ChatsApi.md#unpin_message) | **DELETE** /chats/{chatId}/pin | Unpin message ``` -------------------------------- ### max_client.MessagesApi Method Overview Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md This table provides a quick reference for all methods available in the max_client.MessagesApi, detailing their HTTP request methods, URIs, and a brief description. ```APIDOC Method | HTTP request | Description ------------- | ------------- | ------------- [**answer_on_callback**](MessagesApi.md#answer_on_callback) | **POST** /answers | Answer on callback [**delete_message**](MessagesApi.md#delete_message) | **DELETE** /messages | Delete message [**edit_message**](MessagesApi.md#edit_message) | **PUT** /messages | Edit message [**get_message_by_id**](MessagesApi.md#get_message_by_id) | **GET** /messages/{messageId} | Get message [**get_messages**](MessagesApi.md#get_messages) | **GET** /messages | Get messages [**get_video_attachment_details**](MessagesApi.md#get_video_attachment_details) | **GET** /videos/{videoToken} | Get video details [**send_message**](MessagesApi.md#send_message) | **POST** /messages | Send message ``` -------------------------------- ### Get Pinned Message in Chat using Max Messenger Bot API Client (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Shows how to retrieve the pinned message within a specified chat or channel using the `get_pinned_message` method. It covers API client setup and exception handling. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier to get its pinned message try: # Get pinned message api_response = api_instance.get_pinned_message(chat_id) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->get_pinned_message: %s\n" % e) ``` -------------------------------- ### BotInfo Model Definition Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/BotInfo.md This API documentation defines the `BotInfo` model, which encapsulates information about a bot, including a list of commands it supports. The `commands` property is an optional list of `BotCommand` objects. ```APIDOC BotInfo: properties: commands: type: list[BotCommand] description: Commands supported by bot notes: optional ``` -------------------------------- ### Remove Member from Chat using Max Bot API Python Client Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example illustrates how to remove a member from a chat using the `ChatsApi` from the `max_client` Python library. It requires an API key, a chat identifier, and a user identifier. Additional permissions may be required for this operation. The provided code snippet is incomplete but shows the initial setup. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint ``` ```APIDOC Method: remove_member Description: Removes member from chat. Additional permissions may require. Parameters: chat_id: int (Chat identifier) user_id: int (User identifier) block: bool (optional) Return Type: SimpleQueryResult Authorization: access_token HTTP Request Headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### Max Messenger Upload API Endpoints Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/UploadApi.md A summary of the available methods within the `UploadApi` client, including their HTTP request details and a brief description. ```APIDOC Base URI: https://botapi.max.ru Method | HTTP Request | Description ------------- | ------------- | ------------- get_upload_url | POST /uploads | Get upload URL ``` -------------------------------- ### UnderlineMarkup Model Properties Schema Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/UnderlineMarkup.md Defines the expected schema for properties of the UnderlineMarkup model. Each property entry is described by its name, data type, a description, and any additional notes. ```APIDOC UnderlineMarkup: Properties: - Name: string Type: string Description: string Notes: string ``` -------------------------------- ### API Reference: add_members Method Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Detailed API documentation for the `add_members` method, outlining its parameters, return type, authorization requirements, and supported content types. ```APIDOC add_members(chat_id: int, user_ids_list: UserIdsList) -> SimpleQueryResult Description: Adds members to chat. Additional permissions may require. Parameters: chat_id (int): Chat identifier user_ids_list (UserIdsList): Return Type: SimpleQueryResult Authorization: access_token HTTP Request Headers: Content-Type: application/json Accept: application/json ``` -------------------------------- ### API Reference for answer_on_callback Method Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md Detailed API documentation for the 'answer_on_callback' method, including its parameters, return type, authorization requirements, and accepted content types. ```APIDOC Method: POST /answers Description: Answer on callback. This method should be called to send an answer after a user has clicked the button. The answer may be an updated message or/and a one-time user notification. Parameters: - callback_id (str): Identifies a button clicked by user. Bot receives this identifier after user pressed button as part of `MessageCallbackUpdate` - callback_answer (CallbackAnswer): Return Type: SimpleQueryResult Authorization: access_token HTTP Request Headers: - Content-Type: application/json - Accept: application/json ``` -------------------------------- ### ChatButton Model Properties Reference Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatButton.md Provides a detailed reference for the properties of the `ChatButton` object, including their data types, descriptions, and whether they are optional. This model is used to define buttons that initiate new chats. ```APIDOC ChatButton: Properties: chat_title (str): Title of chat to be created chat_description (str, optional): Chat description start_payload (str, optional): Start payload will be sent to bot as soon as chat created uuid (int, optional): Unique button identifier across all chat buttons in keyboard. If `uuid` changed, new chat will be created on the next click. Server will generate it at the time when button initially posted. Reuse it when you edit the message. ``` -------------------------------- ### API Reference: Get Messages Parameters Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md Describes the parameters, return type, authorization, and HTTP headers for retrieving messages from a chat. Allows filtering by chat ID, message IDs, time range, and count. ```APIDOC Parameters: Name Type Description Notes chat_id int Chat identifier to get messages in chat [optional] message_ids list[str] Comma-separated list of message ids to get [optional] _from int Start time for requested messages [optional] to int End time for requested messages [optional] count int Maximum amount of messages in response [optional] [default to 50] Return type: MessageList Authorization: access_token HTTP request headers: Content-Type: Not defined Accept: application/json ``` -------------------------------- ### HighlightedMarkup Model Properties Schema Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/HighlightedMarkup.md Defines the expected fields for properties within the HighlightedMarkup model. Each property is structured with a Name, Type, Description, and Notes. ```APIDOC HighlightedMarkup Model Properties Schema: Name: string Type: string Description: string Notes: string (No specific properties are listed in this documentation section.) ``` -------------------------------- ### ShareAttachment Model Properties Reference Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ShareAttachment.md Defines the structure and properties of the ShareAttachment object, including its core payload and optional link preview details such as title, description, and image URL. ```APIDOC ShareAttachment Properties: payload: ShareAttachmentPayload description: Payload of the attachment. title: str description: Link preview title. (optional) description: str description: Link preview description. (optional) image_url: str description: Link preview image. (optional) ``` -------------------------------- ### API Reference: SubscriptionsApi.subscribe Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/SubscriptionsApi.md Detailed API documentation for the `subscribe` method, including parameters, return types, authorization, and HTTP headers. ```APIDOC Method: subscribe Description: Subscribes bot from receiving updates via WebHook. Parameters: subscription_request_body: Type: SubscriptionRequestBody Description: Request body for subscription. Return Type: SimpleQueryResult Authorization: access_token HTTP Request Headers: Content-Type: application/json Accept: application/json ``` -------------------------------- ### StrongMarkup Model Properties Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/StrongMarkup.md Defines the properties of the StrongMarkup data model, including name, type, description, and notes for each property. This section serves as a reference for understanding the structure and usage of StrongMarkup objects within the API. ```APIDOC Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- ``` -------------------------------- ### Max Messenger API: MessagesApi.send_message Method Reference Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/MessagesApi.md Detailed API documentation for the `send_message` method within the `MessagesApi` class. It outlines all required and optional parameters, their types, descriptions, the expected return type, authorization requirements, and HTTP request headers. ```APIDOC Method: send_message Parameters: - new_message_body: Type: NewMessageBody Description: Required parameter for the message body. - user_id: Type: int Description: Fill this parameter if you want to send message to user. Notes: Optional - chat_id: Type: int Description: Fill this if you send message to chat. Notes: Optional - disable_link_preview: Type: bool Description: If `false`, server will not generate media preview for links in text. Notes: Optional, Default: False Return Type: SendMessageResult Authorization: access_token HTTP Request Headers: Content-Type: application/json Accept: application/json ``` -------------------------------- ### Delete Chat using Max Bot API Client (Python) Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md This example demonstrates how to delete a chat for all participants using the Max Bot API. It covers configuring API key authorization, creating an API instance, and calling the `delete_chat` method with a specified chat identifier. The snippet also includes basic error handling for API exceptions. ```python from __future__ import print_function import time import max_client from max_client.rest import ApiException from pprint import pprint # Configure API key authorization: access_token configuration = max_client.Configuration() configuration.api_key['access_token'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['access_token'] = 'Bearer' # create an instance of the API class api_instance = max_client.ChatsApi(max_client.ApiClient(configuration)) chat_id = 56 # int | Chat identifier try: # Delete chat api_response = api_instance.delete_chat(chat_id) pprint(api_response) except ApiException as e: print("Exception when calling ChatsApi->delete_chat: %s\n" % e) ``` -------------------------------- ### VideoAttachmentDetails Model Properties Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/VideoAttachmentDetails.md Defines the properties of the `VideoAttachmentDetails` object, including its unique token, URLs for playback/download, thumbnail details, and video dimensions and duration. Some properties are optional, such as URLs and thumbnail if the video is unavailable. ```APIDOC VideoAttachmentDetails: Properties: token: Type: str Description: Video attachment token Notes: Required urls: Type: VideoUrls Description: URLs to download or play video. Can be null if video is unavailable Notes: Optional thumbnail: Type: PhotoAttachmentPayload Description: Video thumbnail Notes: Optional width: Type: int Description: Video width Notes: Required height: Type: int Description: Video height Notes: Required duration: Type: int Description: Video duration in seconds Notes: Required ``` -------------------------------- ### VideoUrls Object Properties Definition Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/VideoUrls.md Defines the properties of the VideoUrls object, including URLs for different video resolutions (1080p, 720p, 480p, 360p, 240p, 144p) and a live streaming (HLS) URL. All properties are optional strings. ```APIDOC VideoUrls Object: Description: Represents a collection of video URLs in various resolutions and live streaming formats. Properties: mp4_1080: Type: str Description: Video URL in 1080p resolution, if available. Optional: true mp4_720: Type: str Description: Video URL in 720p resolution, if available. Optional: true mp4_480: Type: str Description: Video URL in 480p resolution, if available. Optional: true mp4_360: Type: str Description: Video URL in 360p resolution, if available. Optional: true mp4_240: Type: str Description: Video URL in 240p resolution, if available. Optional: true mp4_144: Type: str Description: Video URL in 144p resolution, if available. Optional: true hls: Type: str Description: Live streaming URL, if available. Optional: true ``` -------------------------------- ### API Reference: ChatsApi.get_membership Source: https://github.com/max-messenger/max-bot-api-client-py/blob/main/docs/ChatsApi.md Detailed API documentation for the `get_membership` endpoint, including parameters, return type, authorization, and HTTP headers. ```APIDOC Method: get_membership Description: Get chat membership Parameters: chat_id: int - Chat identifier Return Type: ChatMember Authorization: access_token HTTP Request Headers: Content-Type: Not defined Accept: application/json ```