# ChatGPT Setup

Learn how to use ChatGPT effectively with Tomba API documentation to generate accurate code and get development assistance.

## Quick Use

### Direct Documentation Reference

Reference our documentation directly in your ChatGPT prompts:

```
Please review the Tomba API documentation at https://docs.tomba.io/llms.txt and help me create a Python Flask application that integrates email verification into user registration.
```

### Code Generation with Context

```
Based on the Tomba API documentation (https://docs.tomba.io/llms.txt), generate a complete Node.js Express middleware for email verification that includes:
- Rate limiting
- Error handling
- Response caching
- Logging
- TypeScript types
```

## Project Setup Strategies

### Method 1: Documentation Upload (ChatGPT Plus)

For ChatGPT Plus users with file upload capability:

1. **Download Documentation**:

```bash
curl -L https://docs.tomba.io/llms.txt -o tomba-api-docs.txt
```

2. **Upload to ChatGPT**:
    - Click the attachment button (📎)
    - Upload `tomba-api-docs.txt`
    - Reference it in your prompts

3. **Example Prompt**:

```
Using the uploaded Tomba API documentation, create a comprehensive Python client library with async support, rate limiting, and proper error handling.
```

### Method 2: URL Reference Method

For all ChatGPT users:

```
I'm working with the Tomba API for email verification. The complete API documentation is available at https://docs.tomba.io/llms.txt.

Please help me create a React component that:
1. Validates email addresses in real-time
2. Shows validation results with confidence scores
3. Handles API errors gracefully
4. Includes TypeScript types
5. Uses proper rate limiting
```

### Method 3: Context Building

Build context gradually in your conversation:

**Message 1**:

```
I'm building an email verification service using the Tomba API. The API base URL is https://api.tomba.io/v1 and uses X-Tomba-Key and X-Tomba-Secret headers for authentication. I need help creating a robust client library.
```

**Message 2**:

```
The main endpoints I need to integrate are:
- Email Verifier: GET /email-verifier?email={email}
- Domain Search: GET /domain-search?domain={domain}
- Bulk operations for processing multiple emails
Can you help me start with the email verifier endpoint?
```

## Development Workflows

### 1. API Client Development

**Initial Architecture Discussion**:

```
I need to build a production-ready API client for Tomba email verification service. The API documentation is at https://docs.tomba.io/llms.txt.

Help me design the architecture for a TypeScript client that needs to:
- Handle authentication
- Implement rate limiting
- Provide retry logic
- Cache responses
- Support both individual and bulk operations
- Include comprehensive error handling
- Be easily testable

What would be the best architectural approach?
```

**Implementation Request**:

```
Based on our architecture discussion and the Tomba API docs, implement the core client class with:

1. Constructor that accepts API credentials
2. Private method for making authenticated requests
3. Error handling for different HTTP status codes
4. Rate limiting with exponential backoff
5. TypeScript interfaces for all response types
6. Logging capabilities

Start with the basic structure and authentication.
```

### 2. Framework Integration

**Express.js Integration**:

```
Using the Tomba API (docs at https://docs.tomba.io/llms.txt), help me create an Express.js application with:

1. Middleware for email verification
2. Route handlers for verification endpoints
3. Background job processing for bulk operations
4. Error handling middleware
5. Request logging
6. API documentation with Swagger
7. Rate limiting at the application level
8. Health check endpoints

Please start with the project structure and basic setup.
```

**React Integration**:

```
I want to integrate Tomba email verification into my React application. Based on the API documentation at https://docs.tomba.io/llms.txt, create:

1. Custom React hooks for email operations
2. Context provider for API configuration
3. Form components with real-time validation
4. Loading states and error handling
5. TypeScript throughout
6. Integration with React Query for caching

Begin with the context provider and basic hook structure.
```

### 3. Testing Strategy

**Comprehensive Testing Plan**:

```
For my Tomba API integration (docs: https://docs.tomba.io/llms.txt), help me create a comprehensive testing strategy:

1. Unit tests for all client methods
2. Integration tests with API mocks
3. Error scenario testing
4. Rate limiting tests
5. Performance benchmarks
6. End-to-end tests for user flows
7. Test data and fixtures
8. CI/CD pipeline integration

Start with the testing framework setup and basic unit tests.
```

## Code Generation Examples

### 1. Complete TypeScript Client

**Prompt**:

```
Based on the Tomba API documentation at https://docs.tomba.io/llms.txt, create a complete TypeScript client with:

- Full type definitions for all API endpoints
- Authentication handling
- Request/response interceptors
- Automatic retry with exponential backoff
- Rate limiting
- Caching support
- Comprehensive error handling
- Logging integration
- Configuration options
- JSDoc documentation

Please provide the complete implementation with proper TypeScript types.
```

### 2. Python Async Client

**Prompt**:

```
Using the Tomba API documentation (https://docs.tomba.io/llms.txt), create a Python async client using aiohttp with:

- AsyncTombaClient class
- Async context manager support
- Session management with connection pooling
- Rate limiting with asyncio
- Retry logic with exponential backoff
- Type hints throughout
- Error handling for all scenarios
- Async generators for bulk operations
- Caching with TTL
- Logging integration

Include usage examples and error handling patterns.
```

### 3. React Email Verification Form

**Prompt**:

```
Based on the Tomba API (docs: https://docs.tomba.io/llms.txt), create a React email verification form component with:

- Real-time email validation as user types
- Debounced API calls to avoid rate limits
- Loading states and progress indicators
- Error handling and user feedback
- Confidence score display
- TypeScript throughout
- Accessibility support
- Mobile responsive design
- Integration with React Hook Form
- Unit tests with React Testing Library

Provide the complete component with all dependencies.
```

## Advanced Use Cases

### 1. Microservices Architecture

**Architecture Planning**:

```
I'm designing a microservices architecture for email validation using Tomba API. Based on the documentation at https://docs.tomba.io/llms.txt, help me plan:

Services:
- Email verification service
- Bulk processing service
- API gateway
- Cache service (Redis)
- Queue service
- Monitoring service

Requirements:
- 100k+ requests/day
- 99.9% uptime
- Auto-scaling
- Circuit breaker pattern
- Distributed tracing
- Comprehensive monitoring

Provide service boundaries, communication patterns, and technology recommendations.
```

### 2. Performance Optimization

**Optimization Analysis**:

```
My Tomba API integration is experiencing performance issues:

Metrics:
- 800ms average response time
- 15% timeout rate
- High memory consumption
- Frequent rate limit errors

Current implementation uses:
- Node.js with Express
- Basic HTTP client (axios)
- No caching
- Sequential processing

Based on the Tomba API documentation (https://docs.tomba.io/llms.txt), analyze and provide optimizations for:
1. Connection pooling
2. Request batching
3. Caching strategies
4. Memory management
5. Rate limiting optimization
6. Error recovery

Include code examples for each optimization.
```

### 3. Enterprise Integration

**Enterprise Solution**:

```
Design an enterprise-grade solution for email verification using Tomba API (docs: https://docs.tomba.io/llms.txt) with:

Requirements:
- Multi-tenant architecture
- SSO integration
- Audit logging
- Data privacy compliance
- High availability
- Disaster recovery
- API versioning
- Monitoring and alerting
- Cost optimization
- Security hardening

Provide:
1. Architecture diagram
2. Implementation approach
3. Security considerations
4. Scalability strategy
5. Cost analysis
6. Migration plan
```

## Conversation Management

### 1. Context Preservation

Keep important context in your conversation:

```
For reference, I'm building an email verification service with these requirements:
- Technology: Node.js, TypeScript, Express, Redis
- Scale: 50k requests/day
- SLA: 99.9% uptime, <500ms response time
- API: Tomba (docs: https://docs.tomba.io/llms.txt)

[Continue with specific questions]
```

### 2. Progressive Development

Build features incrementally:

```
Phase 1: Basic email verification
Phase 2: Bulk processing
Phase 3: Caching and optimization
Phase 4: Monitoring and alerting

Let's start with Phase 1. Based on the Tomba API docs, create a basic email verification function.
```

### 3. Code Review and Iteration

```
Here's my current Tomba API client implementation:

[Paste code]

Based on the Tomba API documentation and best practices, please review this code for:
- Security vulnerabilities
- Performance issues
- Error handling gaps
- Type safety improvements
- Code maintainability

Provide specific recommendations with code examples.
```

## Best Practices for ChatGPT

### 1. Specific and Detailed Prompts

Instead of:

```
Help me use Tomba API
```

Use:

```
Based on the Tomba API documentation at https://docs.tomba.io/llms.txt, create a TypeScript service class for email verification that handles rate limiting, caching with Redis, and provides detailed error messages for a React application.
```

### 2. Include Technical Context

```
Context: React TypeScript application using Next.js 14, Tailwind CSS, and React Query
Goal: Integrate Tomba email verification in user registration form
Constraints: Client-side validation, server-side verification, rate limit handling

Using Tomba API docs (https://docs.tomba.io/llms.txt), implement email verification with these requirements...
```

### 3. Request Examples and Tests

```
Along with the implementation, provide:
1. Usage examples
2. Unit tests with Jest
3. Integration test examples
4. Error handling demonstrations
5. Performance considerations
6. Security best practices
```

## Troubleshooting

### Common Issues

1. **Generic Responses**: Be more specific about your requirements and technical stack
2. **Outdated Patterns**: Always reference the current API documentation URL
3. **Incomplete Code**: Ask for complete implementations with error handling
4. **Missing Context**: Provide your technical environment and constraints

### Optimization Tips

1. **Use Follow-up Questions**: "Can you add error handling to the previous code?"
2. **Request Alternatives**: "Show me 3 different approaches to implement this"
3. **Ask for Explanations**: "Explain why you chose this approach over alternatives"
4. **Request Documentation**: "Add JSDoc comments to explain the API usage"

## Additional Resources

- [ChatGPT Best Practices](https://platform.openai.com/docs/guides/prompt-engineering)
- [Tomba API Reference](/api)
- [Authentication Guide](/authentication)
- [Rate Limits Documentation](/rate-limits)
- [Error Handling Guide](/error-handling)
