More Prompts:

Best prompts for ChatGPT for coding using integrating third-party APIs

12 copy-ready, practical prompts to get production-ready code, tests, and architecture for integrating third-party APIs. Each entry includes a concise explanation, a realistic example, and the AIs that work best with the prompt.

GPT-5
Claude Opus 4
Gemini 2.5 Pro
Claude Sonnet 4
Gemini 2.5 Flash
You know that moment when you ask ChatGPT to help integrate a third-party API and it gives you basic examples that fall apart the second you hit production? The code looks clean in the demo, but then you realize it's missing authentication, error handling, rate limiting, and about twelve other things that make your senior developer raise an eyebrow. We've all been there, staring at AI-generated code that works in theory but crumbles under real-world pressure.
This collection of 12 battle-tested prompts transforms your AI coding assistant from a helpful beginner into a seasoned architect who understands production requirements. Each prompt delivers complete, secure implementations covering OAuth flows, webhook handlers, retry strategies, testing frameworks, and caching layers that actually work in the real world. Instead of spending hours debugging and retrofitting basic examples, you'll get enterprise-ready code with proper error handling, security measures, and scalability considerations baked right in.
1
Implement OAuth2 Authorization Code Flow for GitHub (Node.js/Express)
Create a production-ready Node.js (Express) implementation of the OAuth2 Authorization Code flow for GitHub. Requirements: - Use environment variables: GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, REDIS_URL. - Implement routes: GET /auth/github -> redirect to GitHub with scope 'read:user' and a cryptographically-random state stored in Redis; GET /auth/github/callback -> validate state, exchange code at https://github.com/login/oauth/access_token (accept JSON), fetch user profile from https://api.github.com/user using the returned token. - Use axios or node-fetch for HTTP calls, crypto for state, and ioredis for Redis. - Encrypt OAuth tokens before saving to Redis (show encryption key handling via env var), set cookie-based session with HttpOnly and Secure flags. - Add robust error handling, logging comments, and sample unit tests (Jest) for the callback handler using nock to mock GitHub responses. Return code files, a short explanation of security decisions, and example curl commands to test the flow.
Generate a complete, secure OAuth2 authorization-code flow for GitHub using Node.js and Express, including route handlers, state parameter, CSRF protection, token exchange, and storing tokens securely.
2
Type-safe Stripe API Wrapper in TypeScript
Generate a TypeScript wrapper module for Stripe with strict types and small helper functions. Requirements: - Provide functions: createPaymentIntent(amount:number, currency:string, customerId?:string): Promise<PaymentIntentResult>, getCustomer(customerId:string): Promise<CustomerResult>. - Use the official stripe npm package but convert returned objects to simplified typed interfaces. - Implement centralized error mapping (e.g., map Stripe errors to custom Error classes with status codes). - Include an example Next.js API route showing how to use the wrapper with environment variable STRIPE_SECRET_KEY and proper error responses. - Provide unit tests (Vitest) that mock stripe responses and a short README explaining where to place keys and how to extend the wrapper.
Produce a typed, small SDK/wrapper for Stripe in TypeScript that wraps a few common endpoints (create payment intent, retrieve customer), includes error mapping, and shows usage in a Next.js API route.
3
Secure Webhook Handler with Signature Verification (Stripe) in Express
Provide a robust Express webhook handler for Stripe that verifies signatures and prevents duplicate processing. Requirements: - Implement POST /webhooks/stripe using raw body parsing (show middleware configuration). - Use STRIPE_WEBHOOK_SECRET to verify via stripe.webhooks.constructEvent. - Handle event types: payment_intent.succeeded, charge.refunded, checkout.session.completed. - Persist processed event IDs to PostgreSQL (upsert) to ensure idempotency and show SQL schema. - Demonstrate how to run the handler in AWS Lambda (using aws-serverless-express or a minimal adapter) and how to test locally with a curl sample and a mocked stripe signature header. - Explain replay protection and recommended TTL for stored event IDs.
Create a server webhook endpoint that verifies Stripe signatures (raw body), handles event types safely, and demonstrates idempotency and replay protection.
4
Retry and Backoff Wrapper for Unstable Third-Party APIs (Python)
Produce a Python implementation of a retry/backoff decorator for async HTTP calls. Requirements: - Implement @http_retry(max_attempts=5, base_delay=0.5, max_delay=10, statuses=[429,502,503,504], retry_on_exception=(httpx.TimeoutException,)) for async functions that perform HTTPX requests. - Use exponential backoff with full jitter, and expose an on_retry callback hook for logging. - Optionally integrate a simple circuit-breaker using aioredis to store fail counts (provide pseudocode toggled by a flag). - Include an example async function fetch_data() calling https://api.example.com/v1/items and tests (pytest + respx) that simulate failures and assert that the decorator retries as expected. - Explain recommended max_attempts and behavior for 429 with Retry-After header.
Create a reusable Python decorator/wrapper to call HTTP APIs with configurable retries, exponential backoff with jitter, status code handling, and circuit-breaker integration.
5
Transform REST Pagination to Cursor-based GraphQL Resolver (Node.js/Apollo)
Create a Node.js Apollo Server resolver that exposes a GraphQL connection for a third-party REST endpoint that uses page + page_size pagination. Requirements: - Implement cursor encoding/decoding (base64 of JSON {page,index}). - For a request itemsConnection(first: Int, after: String), calculate which REST pages to fetch to fulfill 'first' items with minimal calls. - Return edges [{ cursor,node }] and pageInfo { hasNextPage, endCursor }. - Provide helper code to translate REST items into GraphQL nodes, handle total count, and include an example resolver for GET https://api.example.com/items. - Add unit tests demonstrating fetching across page boundaries (use nock to mock REST responses).
Show how to wrap a paginated REST API (page/page_size) behind a GraphQL cursor-based connection, with encoding/decoding cursors and fetching minimal pages to satisfy GraphQL requests.
6
API Key Rotation Strategy + AWS Lambda Example
Design and implement an API key rotation workflow using AWS Secrets Manager for a third-party service. Requirements: - Provide a Node.js AWS Lambda rotateKey.js that: calls the vendor's key creation endpoint (example vendor: https://admin.example.com/api/keys), stores the new key in Secrets Manager, and archives old keys. - Show how consuming Lambdas should fetch secrets securely (via AWS SDK), cache in-memory with TTL, and automatically refresh when secret version changes (show example code that polls Secrets Manager or subscribes to a rotation SNS topic). - Include recommended IAM policies for rotation Lambda and consumers, a short CloudFormation (or CDK) snippet to create the secret and Lambda trigger (cron), and considerations for key propagation and rolling updates.
Describe and implement an automated API key rotation strategy for a third-party service using AWS Secrets Manager, including code for rotating a key and how Lambdas fetch rotated keys without cold-redeploy.
7
Generate Postman Collection and Tests from OpenAPI Spec
Create a workflow and code to generate a Postman collection from an OpenAPI v3 YAML file. Requirements: - Provide a Node.js script generatePostman.js that reads openapi.yaml and uses openapi-to-postmanv2 (or a similar lib) to produce a collection JSON. - Inject Postman test scripts for endpoints: GET /users (assert 200 and that body is an array) and POST /users (assert 201 and response matches schema). - Provide example Postman test scripts (pm.test and schema validation snippet), instructions to run the script, and a CI step (GitHub Actions) that validates the collection and runs Newman tests against a staging URL.
Convert an OpenAPI (v3) file into a ready-to-run Postman collection, add basic tests for key endpoints, and provide a Node.js script to regenerate the collection programmatically.
AI Flow Chat

Stop Losing Your AI Work

Tired of rewriting the same prompts, juggling ChatGPT and Claude in multiple tabs, and watching your best AI conversations disappear forever?

AI Flow Chat lets you save winning prompts to a reusable library, test all models in one workspace, and convert great chats into automated workflows that scale.

Teach World Class AI About Your Business, Content, Competitors… Get World Class Answers, Content, Suggestions...
AI Flow Chat powers our entire content strategy. We double down on what’s working, extract viral elements, and create stuff fast.
Video thumbnail

Reference Anything

Bring anything into context of AI and build content in seconds

YouTube

PDF

DOCX

TikTok

Web

Reels

Video Files

Twitter Videos

Facebook/Meta Ads

Tweets

Coming Soon

Audio Files

Coming Soon

Choose a plan to match your needs

Upgrade or cancel subscriptions anytime. All prices are in USD.

Basic

For normal daily use. Ideal for getting into AI automation and ideation.

$30/month
  • See what Basic gets you
  • 11,000 credits per month
  • Access to all AI models
  • 5 app schedules
  • Free optional onboarding call
  • 1,000 extra credits for $6
Get Started

No risk, cancel anytime.

ProRecommended

For power users with high-volume needs.

$100/month
  • See what Pro gets you
  • 33,000 credits per month
  • Access to all AI models
  • 10 app schedules
  • Remove AI Flow Chat branding from embedded apps
  • Free optional onboarding call
  • 2,000 extra credits for $6
Get Started

No risk, cancel anytime.

Frequently Asked Questions

Everything you need to know about AI Flow Chat. Still have questions? Contact us.