Skip to content

Conversation

@konard
Copy link
Contributor

@konard konard commented Oct 30, 2025

🎯 Objective

Make web-capture microservice work as expected and integrate it with the Telegram bot.

Fixes: #10


πŸ“Š Current Status

βœ… Completed

🚧 In Progress

  • Awaiting clarification on deployment infrastructure and UX preferences
  • Preparing implementation for web-capture repository
  • Preparing implementation for telegram-bot repository

πŸ“‹ Analysis Summary

Web-Capture Microservice

Current State:

What's Missing:

Telegram Bot

Current State:

  • βœ… Modular router architecture
  • βœ… External service integration pattern
  • βœ… Configuration management
  • βœ… File handling capabilities

What's Missing:

  • ❌ Web-capture service integration
  • ❌ URL detection/handling
  • ❌ Capture commands

🎨 Proposed Implementation

Phase 1: Web-Capture Improvements

  1. Add Integration Tests (Issues Standalone iOS/iPadOS application at AppStoreΒ #5, Support Cursor by our API Gateway for OpenAI modelsΒ #8, Automate sync of master plan using GitHub ActionsΒ #11)

    • GitHub README test
    • Wikipedia page test
    • StackOverflow question test
    • Verify both Puppeteer and Playwright engines
  2. Add Health Check Endpoint

    GET /health
    Response: { status: 'ok', version: '1.0.0', engines: [...] }
  3. Improve Error Handling

    • User-friendly error messages
    • Proper HTTP status codes
    • Detailed logging
  4. Production Readiness

    • Docker Compose configuration
    • Environment variable documentation
    • Deployment guide

Phase 2: Telegram Bot Integration

  1. Configuration

    • Add WEB_CAPTURE_URL to config
    • Add WEB_CAPTURE_ENABLED feature flag
    • Add timeout and engine preferences
  2. Service Client

    • HTTP client for web-capture API
    • Methods: get_html(), get_markdown(), get_screenshot()
    • Error handling and retries
  3. Command Handlers

    • /capture <url> - Interactive with format selection
    • /markdown <url> - Direct markdown capture
    • /screenshot <url> - Direct screenshot capture
  4. User Experience

    • Inline keyboards for format selection
    • Progress messages during capture
    • Smart file handling (message vs document based on size)
    • Friendly error messages

πŸ“ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Telegram  │─────>β”‚ Telegram Bot │─────>β”‚ Web-Capture β”‚
β”‚    Users    β”‚<─────│   (Python)   β”‚<─────│   Service   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β”œβ”€> API Gateway (existing)
                            β”œβ”€> DeepInfra (existing)
                            └─> Web-Capture (new)

User Flow

  1. User sends: /capture https://example.com
  2. Bot shows inline keyboard: [Markdown] [Screenshot] [Both]
  3. User selects format
  4. Bot requests from web-capture service
  5. Bot sends result (text/file/photo)

❓ Clarification Questions (Posted to Issue #10)

Awaiting answers on:

  1. Deployment: Should web-capture be deployed to specific infrastructure, or just ensure it's deployment-ready?
  2. Integration UX: How should users trigger capture?
    • Auto-detect URLs?
    • Explicit commands only?
    • Both?
  3. Output format: How to deliver captured content?
    • Markdown: As text or file?
    • Screenshots: As photo or document?
    • HTML: As file?

πŸ“„ Documentation

This PR includes two comprehensive documents:

1. IMPLEMENTATION_PLAN.md

  • Current state analysis
  • 4-phase implementation strategy
  • Testing strategy
  • Deployment considerations
  • Risk mitigation
  • Timeline estimate

2. WEB_CAPTURE_INTEGRATION.md

  • Detailed architecture design
  • Complete code examples for both repositories
  • Deployment configurations
  • Testing strategy
  • User documentation
  • Future enhancements roadmap

πŸ§ͺ Testing Strategy

Web-Capture

  • Unit tests (existing)
  • Integration tests (new - GitHub, Wikipedia, StackOverflow)
  • E2E tests with Docker

Telegram Bot

  • Unit tests for service client
  • Integration tests with mocked web-capture
  • E2E tests (optional)

βœ… Success Criteria

  • All web-capture integration tests pass
  • Web-capture has health check endpoint
  • Web-capture is deployable via Docker Compose
  • Telegram bot can capture URLs as markdown
  • Telegram bot can capture URLs as screenshots
  • Error handling is robust
  • Documentation is complete
  • Tests verify the integration

πŸ“¦ Next Steps

Once clarification is received:

  1. Implement web-capture improvements
  2. Create PRs to web-capture repository
  3. Implement telegram-bot integration
  4. Create PRs to telegram-bot repository
  5. Test end-to-end integration
  6. Update architecture documentation
  7. Mark this PR as ready for review

πŸ”— Related Issues & PRs

Web-Capture Repository:

This Repository:


πŸ€– Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Fixes #10

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 30, 2025
- Analyzed both web-capture and telegram-bot repositories
- Identified missing integration tests (GitHub, Wikipedia, StackOverflow)
- Defined 4-phase implementation strategy
- Asked clarifying questions in issue #10
- Created detailed technical design for integration

Related to #10
- Detailed architecture and data flow
- Web-capture improvements (tests, health checks, error handling)
- Telegram bot integration design (service client, commands, keyboards)
- Docker Compose deployment configuration
- Testing strategy and user documentation
- Future enhancement roadmap

This document provides complete technical specification for implementing
the web-capture microservice integration with the Telegram bot.

Related to #10
@konard konard changed the title [WIP] Make web-capture microservice work as expected and integrate it with Telegram bot Make web-capture microservice work as expected and integrate it with Telegram bot Oct 30, 2025
@konard konard marked this pull request as ready for review October 30, 2025 04:16
@konard
Copy link
Contributor Author

konard commented Oct 30, 2025

πŸ€– Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

πŸ“Ž Log file uploaded as GitHub Gist (232KB)
πŸ”— View complete solution draft log


Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make web-capture microservice work as expected and integrate it with Telegram bot

2 participants