Metadata-Version: 2.4
Name: markanm
Version: 0.1.0a1
Summary: Official Python SDK for MarkanM Chat Bot Platform & REST API (v0.1.0-alpha)
Author-email: MarkanM Developer Team <developers@markanm.com>
License: MIT License
        
        Copyright (c) 2026 MarkanM Developer Team
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://chat.markanm.com/developers
Project-URL: Documentation, https://chat.markanm.com/developers/docs
Project-URL: Repository, https://github.com/markanm/markanm-python-sdk
Keywords: markanm,bot,chat,sdk,api,oauth,webhooks
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.24.0
Dynamic: license-file

# MarkanM Official Python SDK (`markanm 0.1.0a1`)

Official Python library (v0.1.0-alpha) for building developer bots, automation, and AI agents on **MarkanM Chat** (`https://chat.markanm.com`).

---

## ⚠️ Alpha Release Notice

This is **v0.1.0-alpha** (`markanm 0.1.0a1`). It is intended for testing against the MarkanM Bot API v1.

---

## 🚀 Installation

Install via `pip`:

```bash
pip install markanm
```

---

## ⚡ Quick Start

### 1. Simple Hello Bot (`hello_bot.py`)

```python
import os
from markanm import Bot

bot = Bot(os.environ["MARKANM_BOT_TOKEN"])

@bot.command("hello")
async def hello(ctx):
    await ctx.reply("Hello 👋 Welcome to MarkanM!")

@bot.command("start")
async def start(ctx):
    await ctx.reply("🚀 Bot activated and ready!")

if __name__ == "__main__":
    bot.run_polling()
```

---

### 2. Event Listeners

```python
@bot.on("message.created")
async def on_message(event):
    print(f"New message received: {event.payload}")

@bot.on("member.joined")
def on_member_joined(event):
    print(f"User joined room: {event.payload.get('user')}")
```

---

### 3. AI Assistant Bot (`ai_bot.py`)

```python
import os
from markanm import Bot
from markanm.ai import AI

bot = Bot(os.environ["MARKANM_BOT_TOKEN"])
ai = AI(provider="openai", api_key=os.environ["OPENAI_API_KEY"])

@bot.command("ask")
async def ask(ctx):
    prompt = " ".join(ctx.args)
    if not prompt:
        await ctx.reply("Usage: /ask <question>")
        return

    answer = await ai.generate(prompt)
    await ctx.reply(answer)

bot.run_polling()
```

---

### 4. Webhook Verification (Flask / FastAPI)

```python
from markanm import WebhookHandler, MarkanMWebhookError

handler = WebhookHandler(secret="whsec_YOUR_SECRET", timestamp_tolerance=300)

try:
    # Verifies HMAC-SHA256 signature header and 300s timestamp tolerance
    event = handler.process_event(request_body_text, request_headers.get("X-MarkanM-Signature"))
    print(f"Event verified: {event.id} ({event.type})")
except MarkanMWebhookError as err:
    print(f"Webhook error: {err}")
```

---

## 🧪 Testing

Run tests with `pytest`:

```bash
pytest sdk/python/tests/
```

---

## 📚 API Reference
For complete API endpoints and permission scope guidelines, visit:
**https://chat.markanm.com/developers/docs**
