Voice Platform
Moss + VAPI: Real-Time Search for VAPI Voice Agents
VAPI provides hosted voice agent infrastructure with support for custom knowledge bases via webhooks. The vapi-moss package provides MossVapiSearch, which handles search requests from VAPI and returns results in the expected format. Includes HMAC-SHA256 signature verification for secure webhook handling.
Benefits
Why Use Moss with VAPI
MossVapiSearch handles VAPI Custom Knowledge Base webhook requests with sub-10ms retrieval
Returns results in VAPI's expected {"content", "similarity"} format - no transformation needed
verify_vapi_signature() provides HMAC-SHA256 webhook signature verification for security
Works with any VAPI voice agent - configure the Custom Knowledge Base URL in the VAPI dashboard
Pre-load indexes at server startup for consistent sub-10ms latency on every webhook call
Integration
Quick Start
from vapi_moss import MossVapiSearch, verify_vapi_signature
from moss import MossClient
from fastapi import FastAPI, Request
app = FastAPI()
client = MossClient("your-project-id", "your-project-key")
vapi_search = MossVapiSearch(client)
# Load index at startup
@app.on_event("startup")
async def startup():
await vapi_search.load_index("knowledge-base")
@app.post("/vapi/search")
async def handle_vapi_search(request: Request):
body = await request.body()
# Verify VAPI webhook signature
signature = request.headers.get("x-vapi-signature", "")
verify_vapi_signature(body, signature, "your-vapi-secret")
data = await request.json()
results = await vapi_search.search(
query=data["query"],
index_name="knowledge-base",
top_k=5,
)
# Returns {"content": "...", "similarity": 0.95} format
return resultsSetup
Get Started in 3 Steps
Install vapi-moss
Run pip install vapi-moss to install the VAPI integration package for Moss.
Deploy a webhook endpoint
Create a POST endpoint that uses MossVapiSearch to handle search requests. Verify signatures with verify_vapi_signature() for security.
Configure VAPI Custom Knowledge Base
In the VAPI dashboard, add a Custom Knowledge Base pointing to your webhook URL. VAPI will send search queries to your endpoint on every user turn.
FAQ
Frequently asked questions
Explore