Replit prompt
Third-Party API Integration
Connect to a third-party API with authentication, error handling, rate limiting, and response caching.
Write a Node.js script that integrates with the {{api_name}} API. ## API: {{api_name}} ## API Docs: {{api_docs}} ## What to do: {{integration_purpose}} ## Output: {{output}} ### Integration Requirements **Authentication** {{auth_type}} authentication. Read credentials from environment variables (never hardcode). Handle token refresh if applicable. **API Client Setup** Use axios or node-fetch with base URL and default headers. Set timeout: 30 seconds. Include User-Agent header with your app name. **Implement These Operations:** {{operations}} For each operation: - Function with typed parameters - Input validation before API call - Handle HTTP errors: check response.status before parsing - Parse response and return typed result - Log request + response time (not sensitive data) **Error Handling** ```javascript try { const result = await apiCall(params); return { success: true, data: result }; } catch (error) { if (error.response) { // API returned error response return { success: false, error: error.response.data, status: error.response.status }; } // Network/timeout error return { success: false, error: error.message, status: null }; } ``` **Rate Limiting** Track request count per window. Add delay between requests if approaching limit. Exponential backoff on 429 responses. **Caching** Cache GET responses in memory Map with TTL. Cache key: endpoint + serialized params. **Output** Save results to: {{output}}. Log summary: total processed, successes, failures.
Fill in: {{api_name}}, {{api_docs}}, {{integration_purpose}}, {{output}}, {{auth_type}}, {{operations}}. In Loopy you fill these in a form and copy the finished prompt in one click.
More coding prompts
- CursorAdd File Upload with Cloud StorageMulti-file upload with type checking, size limits, virus scanning, cloud storage, and progress tracking.
- CursorAdd Redis Caching LayerCache-aside Redis caching with typed get/set helpers, TTL management, pattern-based invalidation, and monitoring.
- CursorAdd Stripe Payment IntegrationComplete Stripe checkout, webhooks, subscription management, and billing portal with idempotent webhook handling.
- LovableBooking and Scheduling SystemCalendar-based booking with availability management, confirmations, reminders, and payment collection.
- CursorBuild Admin Dashboard with CRUDData table with server-side CRUD, column sorting and filtering, bulk actions, and role-protected admin panel.
- CursorBuild Data Export FeatureExport large datasets to CSV or Excel with streaming for memory efficiency, background jobs, and signed download links.

