Metadata-Version: 2.5
Name: wibechat
Version: 0.4.0
Summary: Wibechat Python SDK — chat and calling
Project-URL: Homepage, https://wibechat.com
Project-URL: Documentation, https://wibechat.com/developers
License-Expression: MIT
Requires-Python: >=3.10
Requires-Dist: livekit-api>=0.8.0
Requires-Dist: requests>=2.28.0
Description-Content-Type: text/markdown

# Wibechat Python SDK

Chat and calling for Wibechat.

## Installation

```bash
pip install wibechat
```

## Calling

### Using WibechatClient (recommended)

```bash
export WIBECHAT_SERVER_URL=wss://call.wibechat.com
export WIBECHAT_API_KEY=lk_your_license_key_here
export WIBECHAT_CLIENT_ID=your-client-uuid
```

```python
from wibechat import WibechatClient

client = WibechatClient()

token = client.get_token(
    room_name="my-room",
    user_identity="user-123",
    user_name="Alice",
)

print(token.access_token)  # JWT to connect to the room
```

### Using AccessToken directly (advanced)

```python
from wibechat import AccessToken, RoomGrants

token = (
    AccessToken(api_key, api_secret)
    .with_identity("user-123")
    .with_name("Alice")
    .with_grants(RoomGrants(room_join=True, room="my-room", can_publish=True, can_subscribe=True))
    .to_jwt()
)
```

## Chat

### Setup

```bash
export WIBECHAT_CHAT_URL=https://internal.chat.zartek.in
export WIBECHAT_CHAT_EMAIL=you@example.com
export WIBECHAT_CHAT_API_KEY=your_chat_api_key
```

### Send & receive messages

```python
from wibechat import WibechatChat

chat = WibechatChat()

# Send a message to a channel
chat.send_message(to="general", content="Hello!", topic="greetings")

# Send a direct message
chat.send_direct_message(to="alice@example.com", content="Hi Alice!")

# Get recent messages
messages = chat.get_messages(stream="general", num_before=20)
for msg in messages:
    print(f"{msg.sender_name}: {msg.content}")
```

### List channels

```python
streams = chat.get_streams()
for s in streams:
    print(f"#{s.name} — {s.description}")
```

### Real-time events

```python
queue = chat.register_event_queue(event_types=["message", "typing"])

while True:
    events = chat.get_events(queue.queue_id, queue.last_event_id)
    for event in events:
        queue.last_event_id = event["id"]
        if event["type"] == "message":
            m = event["message"]
            print(f"{m['sender_full_name']}: {m['content']}")
```

## Documentation

See the [Wibechat Developer Portal](https://wibechat.com/developers) for full integration guides.
