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="MESSAGE_ID")
    

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.0.0.tar.gz (6.1 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for maxbridge-1.0.0.tar.gz
Algorithm Hash digest
SHA256 715a5402abd815f44ce228c2bf06134f8ff8a0f11db355989c81c10f94531382
MD5 5cf6adddf2f59d099ad1f7394ffa1167
BLAKE2b-256 b53af3eb11e127770d9bcb71a6ffea6ef989cade00c208946e03e79c29977752

See more details on using hashes here.

Provenance

The following attestation bundles were made for maxbridge-1.0.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