Skip to main content

Waappa Python SDK

Official Python SDK for the Waappa API.

Installation

pip install waappa-sdk

Requires Python 3.9 or newer.

Quick Start

from waappa import WaappaClient

waappa = WaappaClient(
    api_key="waappa_session_api_key",
    session="default",
)

waappa.send_text(
    chatId="919876543210@c.us",
    text="Hello from Waappa",
)

The SDK sends the API key as the Authorization header. By default it uses:

https://api.waappa.com

Use base_url for local or private deployments:

waappa = WaappaClient(
    api_key="waappa_session_api_key",
    session="default",
    base_url="http://localhost:3001",
)

Messages

waappa.send_image(
    chatId="919876543210@c.us",
    caption="Invoice",
    file={
        "mimetype": "image/jpeg",
        "filename": "invoice.jpg",
        "url": "https://example.com/invoice.jpg",
    },
)

waappa.send_poll(
    chatId="919876543210@c.us",
    poll={
        "name": "Choose one",
        "options": ["A", "B"],
        "multipleAnswers": False,
    },
)

Supported message helpers:

  • send_text
  • send_image
  • send_voice
  • send_video
  • send_file
  • send_poll
  • send_list
  • send_contact_vcard
  • send_location
  • send_event
  • edit_message
  • delete_message
  • get_messages
  • download_message_media

Media Upload

uploaded = waappa.upload("invoice.jpg")

Use the returned URL in send_image, send_video, send_voice, or send_file.

Media Download

media = waappa.download_message_media("false_919876543210@c.us_3EB0...")

The response contains url, size_bytes, and content_type. The URL is stored in Waappa temporary media storage and can be used like an uploaded media URL.

Groups, Contacts, Labels, LIDs, Channels

waappa.create_group("Support", ["919876543210@c.us"])

contacts = waappa.list_contacts()
labels = waappa.list_labels()
channels = waappa.list_channels()

The client includes helpers for the selected Waappa API surface: groups, group participants, contacts, labels, LID/phone resolution, and channels.

Admin / Session Management

Session management methods require a master key:

admin = WaappaClient(api_key="mk_live_...")
sessions = admin.list_sessions()

Errors

Failed API responses raise WaappaError:

from waappa import WaappaError

try:
    waappa.send_text(chatId="bad", text="Hello")
except WaappaError as error:
    print(error.status)
    print(error.data)

Development

python -m compileall waappa
python -m pip wheel . --no-deps -w dist

Publishing

python -m build
python -m twine upload dist/*

Before publishing, run a smoke test against a real Waappa API key and session.

Metadata

Release files for waappa-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for waappa-sdk 0.1.2
File Size Uploaded
waappa_sdk-0.1.2.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for waappa-sdk 0.1.2
File Interpreter ABI Platform
waappa_sdk-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / waappa_sdk-0.1.2.tar.gz

Download URL waappa_sdk-0.1.2.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ae457e3eddc026b5b4b1eae9ad97429d7a99a94a72ece1255025417e624cc9c0
BLAKE2b-256 checksum
How to use checksums
924d9103f94c9df9b3477fc6275c7e5513793de4eca8ab8d6ce8f43b0db26a13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / waappa_sdk-0.1.2-py3-none-any.whl

Download URL waappa_sdk-0.1.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef26d09946678490d319ddd77e422db28bd483bd5a028cc57ddadb4eb4486e04
BLAKE2b-256 checksum
How to use checksums
23311d2eb8447c33741a3768208078852a2f7628cb1b7027363d7cf935871b45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page