Official Python SDK for the Volga Public API (conversations, messages, outbound webhooks).
Project description
volga
Official Python SDK for the Volga Public API — conversations, messages, and outbound webhooks.
- Zero dependencies (standard library only)
- Automatic retries (429 + 5xx + network) with
Retry-Aftersupport - Cursor auto-pagination via generators
- Built-in webhook signature verification
- Python 3.8+
Install
pip install volga-sdk
(The distribution is volga-sdk; you still import volga.)
Quickstart
import os
from volga import VolgaClient
volga = VolgaClient(api_key=os.environ["VOLGA_API_KEY"])
# List conversations
page = volga.conversations.list(channel="whatsapp", limit=25)
# Send a reply (idempotent retries)
import uuid
volga.messages.send(
conversation_id=page["data"][0]["id"],
text="Thanks for reaching out!",
idempotency_key=str(uuid.uuid4()),
)
Pagination
# One page at a time
page = volga.messages.list(conversation_id="c_123")
print(page["data"], page["has_more"], page["next_cursor"])
# Or auto-paginate every item
for message in volga.messages.iterate(conversation_id="c_123"):
print(message["id"], message["text"])
Webhooks
Register an endpoint (the signing secret is returned once):
endpoint = volga.webhook_endpoints.create(
url="https://example.com/volga/webhooks",
event_types=["message.received", "conversation.created"],
)
# store endpoint["secret"] securely
Verify and parse incoming deliveries (pass the raw request body):
from volga import construct_event, VolgaSignatureVerificationError
@app.post("/volga/webhooks")
def handle(request):
try:
event = construct_event(
secret=os.environ["VOLGA_WEBHOOK_SECRET"],
payload=request.get_data(), # raw bytes, not parsed JSON
signature_header=request.headers.get("Volga-Signature"),
)
except VolgaSignatureVerificationError:
return "", 400
# handle event["type"] / event["data"] ...
return "", 200
Deliveries are at-least-once — deduplicate on the event id (or the
Volga-Delivery-Id header).
Errors
from volga import VolgaRateLimitError, VolgaPermissionError, VolgaApiError
try:
volga.messages.send(conversation_id=cid, text=text)
except VolgaRateLimitError as e:
time.sleep(e.retry_after_sec or 1)
except VolgaPermissionError:
... # the key is missing a scope
except VolgaApiError as e:
print(e.status, e.code, e.message, e.trace_id)
| Class | Status |
|---|---|
VolgaInvalidRequestError |
400 / 422 |
VolgaAuthenticationError |
401 |
VolgaPaymentRequiredError |
402 |
VolgaPermissionError |
403 |
VolgaNotFoundError |
404 |
VolgaConflictError |
409 |
VolgaRateLimitError |
429 |
VolgaServerError |
5xx |
VolgaConnectionError / VolgaTimeoutError |
no response |
Configuration
VolgaClient(
api_key="vk_live_…",
base_url="https://hooks.volga-ai.com/v1", # default
timeout=30.0, # default
max_retries=2, # default
retry_base_delay=0.5,
retry_max_delay=8.0,
)
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file volga_sdk-1.1.0.tar.gz.
File metadata
- Download URL: volga_sdk-1.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e689a312be18d9715814d6cb0951bfac62cd9bb6e489354224c2ad886b0aa1a1
|
|
| MD5 |
0943d14132388f6e2359a85be47d1ac1
|
|
| BLAKE2b-256 |
06a2b3731fbc2e73b6b40cdacd98b22e1c7ddff9c90f37c345e0f3bb68fca738
|
File details
Details for the file volga_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: volga_sdk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
690e44fa3a24171ab2bc0fde5cb808e1d603401cab8a7d4a5949d8e6b57d5dc1
|
|
| MD5 |
0ed7424f094af2032d3dbf6b5d636f54
|
|
| BLAKE2b-256 |
63058abf08e502f206648c8d1ce04e2e07bcc454cb3bc8902ea137d9c0d774b1
|