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
  • 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.

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.2.tar.gz (5.8 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.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: waappa_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 5.8 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.2.tar.gz
Algorithm Hash digest
SHA256 ae457e3eddc026b5b4b1eae9ad97429d7a99a94a72ece1255025417e624cc9c0
MD5 a3a29cc04c3fda45aeaa4f1ac6e2ff10
BLAKE2b-256 924d9103f94c9df9b3477fc6275c7e5513793de4eca8ab8d6ce8f43b0db26a13

See more details on using hashes here.

File details

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

File metadata

  • Download URL: waappa_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ef26d09946678490d319ddd77e422db28bd483bd5a028cc57ddadb4eb4486e04
MD5 1d852177b5911fcbc6f2b5d32ee68dba
BLAKE2b-256 23311d2eb8447c33741a3768208078852a2f7628cb1b7027363d7cf935871b45

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