Skip to main content

Official Python SDK for the MultiWA WhatsApp Business API Gateway.

Project description

MultiWA Python SDK

Official Python SDK for MultiWA - WhatsApp Business API Gateway.

Installation

The SDK is available in this repository today. Public registry publishing (multiwa on PyPI) is tracked as a release follow-up and is not yet verified, so do not assume pip install multiwa resolves to this package on the registry.

Until the registry release is verified, install from this repository:

# From the MultiWA monorepo (recommended for contributors)
pip install -e packages/sdk-python

# From a git ref
pip install "multiwa @ git+https://github.com/ribato22/MultiWA.git#subdirectory=packages/sdk-python"

Quick Start

from multiwa import MultiWA

# Initialize the client. base_url must include the API prefix /api/v1.
#   Local dev: http://localhost:3000/api/v1
#   Docker:    http://localhost:3333/api/v1
#   Prod:      https://your-multiwa-instance.com/api/v1
client = MultiWA(
    base_url="https://your-multiwa-instance.com/api/v1",
    api_key="your-api-key",
)

# Send a text message
result = client.messages.send_text(
    profile_id="your-profile-id",
    to="6281234567890",
    text="Hello from MultiWA Python SDK!"
)

print(result)

Features

Messages

# Send text
client.messages.send_text(profile_id, to, text)

# Send image
client.messages.send_image(profile_id, to, url="https://...", caption="Check this!")

# Send video
client.messages.send_video(profile_id, to, url="https://...", caption="Watch this!")

# Send document
client.messages.send_document(profile_id, to, url="https://...", filename="report.pdf")

# Send location
client.messages.send_location(profile_id, to, latitude=-6.2088, longitude=106.8456)

# Send contact
client.messages.send_contact(profile_id, to, name="John Doe", phone="+6281234567890")

# Send poll
client.messages.send_poll(
    profile_id, to,
    question="What's your favorite color?",
    options=["Red", "Green", "Blue"]
)

Broadcasts

# Create broadcast
client.broadcasts.create(
    profile_id="...",
    name="Promo Campaign",
    recipients=["6281234567890", "6281234567891"],
    template_id="template-uuid"
)

# List broadcasts
broadcasts = client.broadcasts.list(profile_id)

Contacts

# Create contact
client.contacts.create(
    profile_id="...",
    phone="6281234567890",
    name="John Doe",
    tags=["customer", "vip"]
)

# List contacts
contacts = client.contacts.list(profile_id)

Webhooks

# Create webhook
client.webhooks.create(
    profile_id="...",
    url="https://your-webhook.com/whatsapp",
    events=["message.received", "message.sent"]
)

Async Support

import asyncio
from multiwa import AsyncMultiWA

async def main():
    client = AsyncMultiWA(
        base_url="https://your-multiwa-instance.com/api",
        api_key="your-api-key"
    )
    
    result = await client.messages.send_text(
        profile_id="...",
        to="6281234567890",
        text="Hello async!"
    )
    print(result)

asyncio.run(main())

License

MIT - See LICENSE for details.

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

multiwa-1.2.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

multiwa-1.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file multiwa-1.2.0.tar.gz.

File metadata

  • Download URL: multiwa-1.2.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for multiwa-1.2.0.tar.gz
Algorithm Hash digest
SHA256 667f122a4dac193d97361a028b098a25b74e0c9495fcfc16c82045c7cfc00645
MD5 47b7ac8bee1f1370fb3e8b1c1e1fef3a
BLAKE2b-256 235ce7b7070815aa08cab53472dceefff6c18ecfa376cf9554b37f4e03f65110

See more details on using hashes here.

Provenance

The following attestation bundles were made for multiwa-1.2.0.tar.gz:

Publisher: publish-sdk-python.yml on ribato22/MultiWA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file multiwa-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: multiwa-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for multiwa-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1abe95d77aca63975dcaab46006441ed85053951f8a81d5859f70d23cf9e5a78
MD5 b43e8cb2ea00abbc630f0925f0760952
BLAKE2b-256 b5583c7809f288ca76f36694aec14c1876f0accd3672bab21914696a17f7841e

See more details on using hashes here.

Provenance

The following attestation bundles were made for multiwa-1.2.0-py3-none-any.whl:

Publisher: publish-sdk-python.yml on ribato22/MultiWA

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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