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).
WhatsApp templates
Manage each tenant's own WhatsApp message templates and send approved ones.
WhatsApp is contact-initiated, so a business-initiated message must use an
approved template — typically a UTILITY template for transactional content
like receipts.
Scopes: listing/retrieving needs
templates:read(granted by default); creating/deleting needstemplates:write, which is opt-in — grant it to the key in the Volga dashboard (Settings → API keys).
End-to-end flow — create → wait for approval → send:
# 1) Create a template (it starts PENDING; Meta reviews it).
volga.templates.create(
name="comprobante_pago", # lowercase, digits, underscores
language="es_AR",
category="UTILITY",
body_text="Hola {{1}}, tu comprobante por {{2}} está listo.",
body_samples=["Ana", "$1.500"], # one sample per {{n}} placeholder
)
# 2a) Poll its status…
tpl = volga.templates.retrieve("comprobante_pago", language="es_AR")
print(tpl["status"]) # PENDING | APPROVED | REJECTED | PAUSED | DISABLED
# 2b) …or (recommended) subscribe to the webhook and react to approval:
# event_types=["whatsapp.template.status_updated"]
# event["data"] -> {account_id, waba_id, name, language, status, reason?}
# 3) Once APPROVED, send it by opening a WhatsApp conversation:
volga.conversations.create(
channel="whatsapp",
phone="+5491122334455",
template={
"name": "comprobante_pago",
"language": "es_AR",
"components": [
{"type": "body", "parameters": [
{"type": "text", "text": "Ana"},
{"type": "text", "text": "$1.500"},
]},
],
},
)
List, retrieve and delete:
for t in volga.templates.iterate():
print(t["name"], t["status"])
volga.templates.retrieve("comprobante_pago")
volga.templates.delete("comprobante_pago")
Pass account_id (a WhatsApp channel id) on any template call when the tenant
has more than one connected WhatsApp account.
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.2.1.tar.gz.
File metadata
- Download URL: volga_sdk-1.2.1.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c11c31eec572f471c90dd1a8e2c81e7108b9b6efab9c9e2f8d6367f2110364f
|
|
| MD5 |
4e703cea74302291f5df21ad2fa42fb0
|
|
| BLAKE2b-256 |
1836ff21df6dc7ca0df949fbf5e0f00fcb88aab878b6f219f3dd8c85a67c88c2
|
Provenance
The following attestation bundles were made for volga_sdk-1.2.1.tar.gz:
Publisher:
sdk.yml on Prysma-Software/volga-core-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
volga_sdk-1.2.1.tar.gz -
Subject digest:
3c11c31eec572f471c90dd1a8e2c81e7108b9b6efab9c9e2f8d6367f2110364f - Sigstore transparency entry: 2138537608
- Sigstore integration time:
-
Permalink:
Prysma-Software/volga-core-lite@ac19375815320b1d08560f554a186a7bd5b4ecd5 -
Branch / Tag:
refs/tags/sdk-py-v1.2.1 - Owner: https://github.com/Prysma-Software
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk.yml@ac19375815320b1d08560f554a186a7bd5b4ecd5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file volga_sdk-1.2.1-py3-none-any.whl.
File metadata
- Download URL: volga_sdk-1.2.1-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
943246c13d0e83f3e095a6755777a1dab01d88731ba51079aa0baf8c7be7991d
|
|
| MD5 |
b0c0e5b1ac69b0aef4ca4f7c20276c5e
|
|
| BLAKE2b-256 |
e17d35ba38c908800722c79a9a92da9165f9252d5c026ced50f402800a995fc3
|
Provenance
The following attestation bundles were made for volga_sdk-1.2.1-py3-none-any.whl:
Publisher:
sdk.yml on Prysma-Software/volga-core-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
volga_sdk-1.2.1-py3-none-any.whl -
Subject digest:
943246c13d0e83f3e095a6755777a1dab01d88731ba51079aa0baf8c7be7991d - Sigstore transparency entry: 2138537656
- Sigstore integration time:
-
Permalink:
Prysma-Software/volga-core-lite@ac19375815320b1d08560f554a186a7bd5b4ecd5 -
Branch / Tag:
refs/tags/sdk-py-v1.2.1 - Owner: https://github.com/Prysma-Software
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk.yml@ac19375815320b1d08560f554a186a7bd5b4ecd5 -
Trigger Event:
push
-
Statement type: