Skip to main content

Official Python SDK for the Waappa API.

Project description

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

Media Upload

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

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

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.

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

waappa_sdk-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

waappa_sdk-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file waappa_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: waappa_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for waappa_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ccdd685e4a67dcd7f9d63f4492722fb01b7b84502b35c350c928b4efe837bb3a
MD5 6f4c2ef864b4339b902cb07a703bbabd
BLAKE2b-256 6f7544bc7dcfb7e6e21b878a8dbd7f8accd52fa14d14a571d5a4cfa945824ae7

See more details on using hashes here.

File details

Details for the file waappa_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: waappa_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for waappa_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 557a48edcb2bc73a6cd52e5284a7d72b2172d31e9133d20640e2e97d9672afba
MD5 9b7d6e94d44fe0b9fecff0ea5fca6406
BLAKE2b-256 e3084365bc5274129cb339e95cf807f5ed2b2d83fce919e5f2174fc34ecc8402

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