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

Uploaded Python 3

File details

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

File metadata

  • Download URL: multiwa-1.0.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.0.0.tar.gz
Algorithm Hash digest
SHA256 7c0862d64c42176c635572809741d23742b1a46bf3f31d8b5218954131ed546f
MD5 9d59038898573bccab574de7205e9863
BLAKE2b-256 65fb3bf1049f9fd8812692a8b65d0ee2492d7a0bccd4cb5a3ef890b411d6a3b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for multiwa-1.0.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.0.0-py3-none-any.whl.

File metadata

  • Download URL: multiwa-1.0.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 558616b40b3b2cc06b453bb745178d03fbc33e482a692cf1b2dfc330dbd91205
MD5 25655c65b6d0255ac2452613a71db5c0
BLAKE2b-256 abfa5a490624012e19651c5555bc27868170fc2fea6e35689a538d9783f73e53

See more details on using hashes here.

Provenance

The following attestation bundles were made for multiwa-1.0.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