Polling provides a pull-based mechanism for retrieving automation task results. After submitting a task via the Remote Dispatch API, you can periodically check for completion using the Get Task Status endpoint.
Simple Setup
No webhook endpoints or server infrastructure required to get started
Firewall Friendly
Works in restricted network environments without opening inbound ports
No Server Required
Perfect for scripts, CLI tools, and applications without a web server
Full Control
You decide when and how often to check for results
The task completed successfully. Process the response data.
Copy
{ "status": "error", "response": { "text": "Failed to complete the task due to network timeout." }, "createdAt": "2024-12-19T00:00:00.000000+00:00", "completedAt": "2024-12-19T00:02:30.000000+00:00"}
The task failed. Log the error and implement retry logic if appropriate.
Copy
{ "status": "input-required", "response": { "text": "The task requires authentication. Please log in to continue." }, "createdAt": "2024-12-19T00:00:00.000000+00:00", "completedAt": null}
The task needs user input. Notify the user or handle programmatically.
Start with polling for development and simple use cases. Migrate to webhooks when you need real-time notifications or are handling high volumes of tasks.
Problem: Making too many requests and hitting rate limits.Solution: Use a reasonable polling interval of 5-10 seconds. This balances responsiveness with API efficiency.
Copy
POLL_INTERVAL = 5 # seconds - good balance for most use casestime.sleep(POLL_INTERVAL)
No Timeout Implemented
Problem: Script runs forever if a task never completes.Solution: Always set a maximum timeout for your polling loop.
Copy
start = time.time()while time.time() - start < MAX_TIMEOUT: # poll...raise TimeoutError("Task did not complete in time")
Not Handling All Status Types
Problem: Code breaks when receiving unexpected status values.Solution: Handle all possible statuses: pending, success, error, and input-required.
Production Checklist: Before deploying, ensure you have reasonable polling intervals, maximum timeouts, comprehensive error handling, and logging implemented.