Use the Vennio API from Python with the requests library. No SDK required — just standard HTTP.
pip install requests python-dotenv
import os
import requests
from dotenv import load_dotenv
load_dotenv()
BASE_URL = "https://api.vennio.app"
API_KEY = os.environ["VENNIO_API_KEY"]
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
def get_available_slots(business_id, duration_minutes=30):
response = requests.get(
f"{BASE_URL}/v1/availability/slots",
headers=HEADERS,
params={
"business_id": business_id,
"duration": duration_minutes,
"timezone": "America/New_York",
}
)
response.raise_for_status()
data = response.json()
return data["slots"]
slots = get_available_slots("your-business-id")
print(f"Found {len(slots)} available slots")
for slot in slots[:3]:
print(f" {slot['start']} — {slot['end']}")
def create_booking(business_id, slot, customer_email, customer_name):
response = requests.post(
f"{BASE_URL}/v1/bookings",
headers={**HEADERS, "Content-Type": "application/json"},
json={
"business_id": business_id,
"customer_email": customer_email,
"customer_name": customer_name,
"start_time": slot["start"],
"end_time": slot["end"],
}
)
response.raise_for_status()
return response.json()["booking"]
booking = create_booking(
business_id="your-business-id",
slot=slots[0],
customer_email="customer@example.com",
customer_name="Jane Doe"
)
print(f"Booking created: {booking['id']} ({booking['status']})")
import hashlib
import hmac
from flask import Flask, request, jsonify
app = Flask(__name__)
WEBHOOK_SECRET = os.environ["VENNIO_WEBHOOK_SECRET"]
@app.route("/webhooks/vennio", methods=["POST"])
def handle_webhook():
signature = request.headers.get("X-Webhook-Signature", "")
expected = hmac.new(
WEBHOOK_SECRET.encode(),
request.get_data(),
hashlib.sha256
).hexdigest()
if not hmac.compare_digest(signature, expected):
return jsonify({"error": "Invalid signature"}), 401
event = request.json
print(f"Received event: {event['type']}")
if event["type"] == "booking.created":
booking = event["data"]["booking"]
# Handle new booking...
return jsonify({"received": True})
if __name__ == '__main__':
app.run(port=5000)