Endpoint
Request Body
Unique identifier for the call (minimum 8 characters)Example:
"call_abc123xyz"Tenant identifier for configuration lookup (minimum 3 characters)Example:
"tenant-production-001"Response
Returns202 Accepted with processing status.
The call identifier from the request
The tenant identifier from the request
Whether the call was successfully added to the processing queue
true: Call was enqueued for processingfalse: Call was already queued, in-progress, or completed
Processing status indicatorPossible values:
"queued": Call enqueued successfully"already_queued_or_in_progress": Call is already being processed"already_completed": Call was previously completed (idempotent rejection)
Example Request
Example Responses
Successfully Enqueued
Already Completed
Already In Progress
Processing Behavior
Idempotency
The endpoint implements idempotency at two levels:- Database-level: Checks
processed_statusin MongoDB before enqueuing - Queue-level: Rejects duplicate
(call_id, tenant_id)pairs already in queue or being processed
src/apps/post_call/api/v1/endpoints/process.py:65-86
Status Checking
Before enqueuing, the endpoint:- Queries MongoDB for existing
processed_status - Returns
already_completedif status iscompleted - Sets status to
pendingfor all other cases - Proceeds with queue enqueue operation
src/apps/post_call/api/v1/endpoints/process.py:56-116
Queue Management
TheCallQueue prevents duplicates:
(call_id, tenant_id) key exists in either set.
Source: src/apps/post_call/app/call_queue.py:19-46
Error Responses
400 Bad Request
Returned when validation fails:src/apps/post_call/api/v1/endpoints/process.py:36-42
500 Internal Server Error
Returned when the call queue is not initialized:src/apps/post_call/api/v1/endpoints/process.py:52-54
Background Processing
After a call is enqueued, the background worker performs:- Fetch Data: Retrieves transcript and metadata from MongoDB
- Assemble Transcript: Reconstructs ordered transcript from linked items
- Check Empty: Detects empty transcripts (seq ≤ 2 or no content)
- Summarize: Calls OpenAI API for non-empty transcripts
- Send Email: Delivers summary to tenant recipients
- Update Status: Sets
processed_statustocompleted
Manual Reprocessing
Failed calls can be manually reprocessed:- Allowed: Calls with
processed_status=failedorpending - Blocked: Calls with
processed_status=completed
call_id and tenant_id.
Source: src/apps/post_call/api/v1/endpoints/process.py:28-34
Schema Reference
ProcessRequest
src/apps/post_call/api/v1/endpoints/process.py:14-16
ProcessResponse
src/apps/post_call/api/v1/endpoints/process.py:19-23
CallJob
src/apps/post_call/app/call_queue.py:7-11
Related
Processing Overview
Learn about the complete processing flow
Webhooks
Configure webhooks for processing events