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.0.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.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: waappa_sdk-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 3f8eeb885126c0fbf338087279d888ee5a8e78b114a04b806a313d3d08004f45
MD5 e02fc3cc86fd1f4f125101cd5d541693
BLAKE2b-256 3f08493cf8e49e31e5ada0d5b25f7617d0f588c4242c739d243e045bcc63cefd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: waappa_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30e7d31f17fc7683b6eaa693ebb3a65f124fa2670a604959215fc38b27a07745
MD5 e99873d6ddcc12a789056c1423627301
BLAKE2b-256 dca16bafaf345d776074504980e672b121c4abb6dca0ece509393755b642ee30

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