Skip to main content

An API wrapper for Max.

Project description

Max API Interface

The Max API Interface allows you to interact with the Max Messenger WebSocket API for sending messages, retrieving histories, and subscribing to real-time events.

Getting Started

Prerequisites

  • Python 3.x

Installing

To install this library, run the following command in your terminal:

pip install MaxBridge

Obtaining the Authentication Token

To interact with the Max API, you'll need to authenticate and obtain a long-lived authentication token (from a legitimate web session). Follow these steps:

  1. Open your web browser and navigate to Max Messenger Web Version.

  2. Log in to your Max account if you haven't done so already.

  3. After logging in, open the Developer Tools in your web browser (right-click anywhere on the page and select "Inspect" or press F12).

  4. Go to the "Application" tab in Developer Tools.

  5. Find and click on "Local storage" in the left sidebar under the "Storage" section. Look for the cookies belonging to the https://web.max.ru domain.

  6. Find the authentication token. This token is a value of __oneme_auth.

  7. Copy the value of the authentication token. You'll use this value to authenticate your requests in the MaxAPI class.

Using the Max API Interface

Initializing the MaxAPI class

To create an instance of the MaxAPI, pass the authentication token obtained from the previous step:

from MaxBridge import MaxAPI

auth_token = 'YOUR_AUTH_TOKEN_HERE'
api = MaxAPI(auth_token)

Available Methods

  1. Sending a Message:

    To send a message, use:

    api.send_message(chat_id=12345678, text="Hello, World!")
    
  2. Retrieving Message History:

    To retrieve message history, use:

    response = api.get_history(chat_id=12345678, count=20)
    
  3. Subscribing to a Chat:

    To subscribe to real-time events from a chat, use:

    api.subscribe_to_chat(chat_id=12345678, subscribe=True)
    
  4. Marking Messages as Read:

    To mark a specific message as read, use:

    api.mark_as_read(chat_id=12345678, message_id="12345678")
    
  5. Getting video or file

    To get video, use:

    api.get_video(id=12345678)
    

    To get file, use:

    api.get_file(id=12345678, chat_id=12345678, msg_id="12345678")
    
  6. Finding Contact by Phone Number:

    To find a contact by their phone number, use:

    api.get_contact_by_phone(phone_number="+12345678901")
    
  7. Getting Chat by ID:

    To retrieve a specific chat by its ID, use:

    api.get_chat_by_id(chat_id="12345678")
    
  8. Getting All Chats:

    To retrieve all available chats, use:

    api.get_all_chats()
    

The chat ID is required for most operations. You can obtain it from the chat URL or through other means specific to your application.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maxbridge-1.5.0.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file maxbridge-1.5.0.tar.gz.

File metadata

  • Download URL: maxbridge-1.5.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for maxbridge-1.5.0.tar.gz
Algorithm Hash digest
SHA256 0db45a64e1cde74eea050df0df61bd2e0227bd340f180c7b08453febeb04573c
MD5 a37271b13cdcc9264160835c80310e5e
BLAKE2b-256 b057789ae4500afdc675b095393b8562fde79ca2f3df19a34ae30ff5417c90f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for maxbridge-1.5.0.tar.gz:

Publisher: python-publish.yml on Sharkow1743/MaxAPI

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page