Skip to main content

Official Python SDK for Achek — WhatsApp OTP, AI chatbots & business messaging for Nigeria

Project description

achek — Python SDK

Official Python SDK for Achek — WhatsApp OTP, automated alerts, transaction notifications, broadcasts, and support ticket tracking for Nigeria and Africa.

PyPI Python License: MIT

Install

pip install achek-sdk

Quick Start

from achekverify import AchekConnect

client = AchekConnect(api_key="your_api_key")

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

# Verify the code the user entered
verification = client.otp.verify(request_id, user_code)
if verification["valid"]:
    login_user()  # ✅

Get your API key from the Achek dashboard.


OTP Verification

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

# 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"}

# Fetch OTP logs
logs = client.otp.logs(limit=20, status="verified")

Transaction Alerts

Send formatted debit/credit/transfer alerts directly to a customer's WhatsApp:

client.alerts.transaction(
    "+2348012345678",
    type="debit",
    amount=15000,
    reference="TXN-20240519-001",
    account_name="Emeka Okafor",
    balance=240000,
    description="Transfer to Kuda",
)

This automatically sends a clean WhatsApp message:

💸 Debit Alert

Amount: ₦15,000.00
Account: Emeka Okafor
Ref: `TXN-20240519-001`
Narration: Transfer to Kuda
Balance: ₦240,000.00

_Powered by Achek_

Custom Alerts

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

Broadcasts

Send a single WhatsApp message to up to 1,000 recipients at once:

result = client.broadcasts.send(
    name="Black Friday Promo",
    message="🔥 *50% OFF* today only! Code: *FRIDAY50*",
    recipients=["+2348012345678", "+2349087654321"],  # up to 1000
)

# Check delivery status
status = client.broadcasts.status(result["id"])

Support Ticket Tracking

Create support tickets and keep customers updated on WhatsApp automatically:

# Create a ticket — customer gets a WhatsApp notification
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 — customer gets a WhatsApp update
client.tickets.update(
    ticket_id,
    status="in_progress",
    notify_customer=True,
    notification_message="We're investigating — expected resolution: 2 hours.",
)

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

# List open tickets
open_tickets = client.tickets.list(status="open")

Error Handling

from achekverify import AchekConnect, AchekConnectError

try:
    client.otp.send("+2348012345678")
except AchekConnectError as e:
    print(e.args[0])     # "No active subscription"
    print(e.status_code) # 402
    print(e.code)        # "SUBSCRIPTION_REQUIRED"

Configuration

client = AchekConnect(
    api_key="your_api_key",
    base_url="https://api.achek.com.ng",  # override if self-hosted
    timeout=15,                            # seconds (default: 15)
)

API Reference

Module Method Description
otp send(phone, **kwargs) Send WhatsApp OTP
otp verify(request_id, code) Verify OTP code
otp logs(**kwargs) Fetch OTP delivery logs
alerts send(phone, message, **kwargs) Send custom WhatsApp alert
alerts transaction(phone, **kwargs) Send formatted transaction alert
broadcasts send(name, message, recipients) Send broadcast to up to 1,000 numbers
broadcasts list() List recent broadcasts
broadcasts status(broadcast_id) Get broadcast delivery status
tickets create(phone, subject, **kwargs) Create support ticket
tickets list(**kwargs) List tickets
tickets get(ticket_id) Get ticket by ID
tickets update(ticket_id, **kwargs) Update status/priority
tickets resolve(ticket_id, message?) Resolve and notify customer

Links

License

MIT — see LICENSE

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

achek_sdk-1.0.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

achek_sdk-1.0.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file achek_sdk-1.0.2.tar.gz.

File metadata

  • Download URL: achek_sdk-1.0.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for achek_sdk-1.0.2.tar.gz
Algorithm Hash digest
SHA256 fe84e0cf55b19c4ee7850648448dee8433d6262350d5c5c606ebb3a55c571b4a
MD5 e0e24c6fd8aeb3a9520fb62d13613efb
BLAKE2b-256 436d375cc6fb35759de6a37c435c13d6a329f3ff8f673bb3886c624239134f36

See more details on using hashes here.

File details

Details for the file achek_sdk-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: achek_sdk-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for achek_sdk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 de6131efdc51da971bca3372fadca88817218c1a6575ce2b26692335a6aa3dfb
MD5 cc7967f03679af27387f25f539464afc
BLAKE2b-256 af12f8eea17c9626bb3ee7d661703e317f1b21d167dea709247c871bd6ef1ee6

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