Metadata-Version: 2.4
Name: achekverify
Version: 1.0.0
Summary: Official Python SDK for Achek Connect — WhatsApp OTP, alerts, broadcasts and ticket tracking
Author-email: Achek <hello@achek.com.ng>
License: MIT
Project-URL: Homepage, https://achek.com.ng
Project-URL: Documentation, https://achek.com.ng/docs
Project-URL: Repository, https://github.com/achek/achekverify-python
Project-URL: Bug Tracker, https://github.com/achek/achekverify-python/issues
Keywords: whatsapp,otp,verification,nigeria,sms,alerts,achekverify
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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 :: Telephony
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# achekconnect — Python SDK

Official Python SDK for [Achek Connect](https://verify.achek.com.ng) — WhatsApp OTP verification, automated alerts, transaction notifications, and ticket tracking.

## Install

```bash
pip install achekconnect
```

## Quick Start

```python
from achekconnect import AchekConnect

client = AchekConnect(api_key="watp_live_xxxxxxxxxxxx")

# Send OTP
result = client.otp.send("+2348012345678")
request_id = result["requestId"]

# Verify OTP
verification = client.otp.verify(request_id, user_code)
if verification["valid"]:
    login_user()  # ✅
```

## OTP Verification

```python
# Simple send
result = client.otp.send("+2348012345678")

# With custom template (Growth+ plans)
result = client.otp.send(
    "+2348012345678",
    template="Hi {{name}}, your {{company}} code is {{code}}. Valid 10 mins.",
    recipient_name="Emeka",
    company_name="MyApp",
)

# Verify
result = client.otp.verify(request_id, "847293")
# {"valid": True, "message": "OTP verified successfully"}

# View logs
logs = client.otp.logs(limit=20, status="verified")
```

## Transaction Alerts

```python
client.alerts.transaction(
    "+2348012345678",
    type="debit",
    amount=15000,
    reference="TXN-20240519-001",
    account_name="Emeka Okafor",
    balance=240000,
    description="Transfer to Kuda",
)
# Sends WhatsApp message:
# 💸 Debit Alert
# Amount: ₦15,000.00
# Account: Emeka Okafor
# Ref: `TXN-20240519-001`
# Narration: Transfer to Kuda
# Balance: ₦240,000.00
```

## Custom Alerts

```python
client.alerts.send(
    "+2348012345678",
    "*Your account has been credited with ₦5,000* 🎉",
    category="notification",
)
```

## Ticket Tracking

```python
# Create ticket
ticket = client.tickets.create(
    "+2348012345678",
    "Payment not reflecting",
    description="Paid ₦5,000 but order not updated",
    priority="high",
    notify_customer=True,
)
ticket_id = ticket["ticketId"]

# Update
client.tickets.update(ticket_id, status="in_progress", notify_customer=True,
    notification_message="We're investigating — expect resolution in 2 hours.")

# Resolve
client.tickets.resolve(ticket_id, "Your issue has been fixed! Check your account.")
```

## Broadcasts

```python
client.broadcasts.send(
    name="Black Friday Promo",
    message="🔥 *50% OFF* today only! Code: *FRIDAY50*",
    recipients=["+2348012345678", "+2348087654321"],
)
```

## Error Handling

```python
from achekconnect import AchekConnect, AchekConnectError

try:
    client.otp.send("+2348012345678")
except AchekConnectError as e:
    print(e)            # "No active subscription..."
    print(e.status_code)  # 402
    print(e.code)        # "PHONE_NOT_VERIFIED" etc.
```
