When to use polling vs webhooks
| Use Case | Recommended Approach |
|---|---|
| Server-side applications that can receive HTTP requests | Webhooks |
| Client-side applications (browser, mobile) | Polling |
| Serverless functions with short timeouts | Webhooks |
| Local development without ngrok | Polling |
| Real-time progress monitoring | Polling |
| Fire-and-forget batch processing | Webhooks |
Basic usage
- TypeScript
Response structure
When polling session status, you’ll receive a response with the following fields:Field descriptions
| Field | Type | Description |
|---|---|---|
in_progress | boolean | true if the session is still running, false when complete |
success | boolean | null | Session outcome: null while running, true if successful, false if failed |
metadata | object | null | Custom metadata provided when starting the session |
workflow_metadata | object | null | Metadata defined in the workflow configuration |
file_metadata | array | null | List of files downloaded during the session |
Polling with timeout
For production use, always implement a timeout to prevent infinite polling:- TypeScript
Monitoring file downloads
Thefile_metadata field updates in real-time as files are downloaded during the session. You can use this to track download progress:
- TypeScript
