Skip to main content

Python async client for EdgyMeow WebSocket API

Project description

EdgyMeow - Python Client

Async Python client for the EdgyMeow WebSocket API.

Installation

pip install edgymeow

Requires the EdgyMeow server running separately:

npm install -g edgymeow
npx edgymeow start

Usage

import asyncio
from edgymeow import WhatsAppRPCClient

async def main():
    client = WhatsAppRPCClient("ws://localhost:9400/ws/rpc")
    await client.connect()

    # Check status
    status = await client.status()
    print(status)

    # Send a text message
    await client.send(phone="1234567890", type="text", message="Hello!")

    # Send an image
    await client.send(
        phone="1234567890",
        type="image",
        media_data={
            "data": "<base64>",
            "mime_type": "image/jpeg",
            "caption": "Check this out!"
        }
    )

    # List groups
    groups = await client.groups()

    # Get chat history
    history = await client.chat_history(phone="1234567890", limit=50)

    # List subscribed channels
    channels = await client.newsletters()

    # Get channel stats
    stats = await client.newsletter_stats(jid="123456789@newsletter", count=20)

    await client.close()

asyncio.run(main())

Events

async def main():
    client = WhatsAppRPCClient("ws://localhost:9400/ws/rpc")

    def on_event(event):
        if event["method"] == "event.message_received":
            print(f"New message: {event['params']['text']}")

    client.event_callback = on_event
    await client.connect()

    # Keep running to receive events
    await asyncio.sleep(3600)
    await client.close()

API Methods

Method Description
status() Get connection status
start() / stop() / restart() Control WhatsApp service
qr() Get QR code for pairing
send(**kwargs) Send message (text, image, video, audio, document, location, contact)
media(message_id) Download media from message
groups() List all groups
group_info(group_id) Get group details
contacts(query) List contacts
contact_check(phones) Check WhatsApp registration
chat_history(**kwargs) Get message history
typing(jid, state) Send typing indicator
presence(status) Set online/offline
mark_read(message_ids, chat_jid) Mark messages as read
rate_limit_get() / rate_limit_set(**config) Rate limiting config
newsletters(refresh) List subscribed channels
newsletter_info(jid, invite, refresh) Get channel details
newsletter_create(name, description, picture) Create a channel
newsletter_follow(jid) Subscribe to a channel
newsletter_unfollow(jid) Unsubscribe from a channel
newsletter_mute(jid, mute) Mute/unmute a channel
newsletter_messages(jid, count, before) Get channel messages
newsletter_send(group_id, type, message, media_data) Send to channel (admin only)
newsletter_mark_viewed(jid, server_ids) Mark messages as viewed
newsletter_react(jid, server_id, reaction) React to a channel message
newsletter_live_updates(jid) Subscribe to live updates
newsletter_stats(jid, invite, count) Get channel statistics

License

MIT

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

edgymeow-0.0.18.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

edgymeow-0.0.18-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file edgymeow-0.0.18.tar.gz.

File metadata

  • Download URL: edgymeow-0.0.18.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for edgymeow-0.0.18.tar.gz
Algorithm Hash digest
SHA256 63ada3ece4d99575ab11d195a2221cef6b0e8fe74bfab4b01b94f9fc0485a3f2
MD5 ef5804d09e9d7691b2c850c42d48532b
BLAKE2b-256 7a4cf06376e9a0640b40409b18e9f4cea8b8ca5bc34b05f755148359060ae584

See more details on using hashes here.

File details

Details for the file edgymeow-0.0.18-py3-none-any.whl.

File metadata

  • Download URL: edgymeow-0.0.18-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for edgymeow-0.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 bb8c67f25f68534f6d82bb9d40b3e6fb5823a6b6fcf30e565085154f35cad869
MD5 b4616dd230ac89cb6008b2ef13a0785b
BLAKE2b-256 f39be296c5927235de421f73cbd5c20b567e8e7ba6df0b12d21dc09ff2ed378a

See more details on using hashes here.

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