enhancementgood first issueintegrationnew-featurenew-integration
仓库指标
- 星标
- (1,930 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Description
Add Swiggy integration to sync food delivery orders, restaurant data, and order tracking into CORE.
Reference Implementations
Existing Integrations (use as templates)
integrations/github/- OAuth-based integrationintegrations/linear/- For referenceintegrations/slack/- For reference
Required Files Structure
integrations/swiggy/
├── src/
│ ├── index.ts # Main entry, auth spec
│ ├── schedule.ts # Sync logic
│ ├── utils.ts # Swiggy API utilities
│ ├── account-create.ts # Auth setup
│ └── create-activity.ts # Activity formatting
├── package.json
├── tsup.config.ts
└── README.md
Swiggy API Integration
OAuth Setup
- No official public API with OAuth is available for general developers.
- Swiggy has a Developer Portal that provides limited API access, primarily intended for partner integrations (restaurants, delivery partners).
- Authentication method: Session-based / API Key (partner-only)
- For community/unofficial use, cookie-based authentication from the Swiggy web app has been used.
Known Unofficial Endpoints
GET https://www.swiggy.com/dapi/restaurants/list/v5- List restaurants by locationGET https://www.swiggy.com/dapi/menu/pl?page-type=REGULAR_MENU&complete-menu=true&lat={lat}&lng={lng}&restaurantId={id}- Get restaurant menuGET https://www.swiggy.com/dapi/order/all- Get order history (requires auth cookies)GET https://www.swiggy.com/dapi/order/track- Track active order (requires auth cookies)
Events to Track
-
Orders
- New orders placed
- Order status updates (confirmed, preparing, out for delivery, delivered)
- Order cancellations
- Order ratings and reviews
-
Restaurants
- Favorite restaurant updates
- Menu changes
- Restaurant availability status
-
Account Activity
- Payment transactions
- Swiggy One membership status
- Address updates
Implementation Tasks
- Set up basic integration structure following
integrations/github/src/index.tspattern - Investigate Swiggy Developer Portal for official partner API access
- Implement cookie/session-based authentication in
account-create.ts - Create Swiggy API utilities in
utils.ts - Implement sync logic in
schedule.tsfor order history - Convert Swiggy events to CORE activity format
- Add error handling and rate limiting
- Create integration documentation
- Add to
integrations/README.md
Technical Notes
- Important: Swiggy does NOT have a well-documented public REST API for third-party developers. The Developer Portal at developers.swiggy.com exists but is primarily for restaurant and delivery partners.
- Most community projects use unofficial/undocumented API endpoints by reverse-engineering the Swiggy web application.
- Authentication for unofficial endpoints requires Swiggy session cookies (obtained after logging in via the web app).
- These unofficial endpoints are subject to change without notice and may break at any time.
- Swiggy is India-focused; API responses contain INR pricing and Indian addresses.
- Consider using a headless browser or session management approach for authentication.
- Rate limits on unofficial endpoints are unknown; implement conservative rate limiting.
- This integration carries inherent risks due to reliance on unofficial APIs. Clearly communicate this to users.
Resources
- Swiggy Developer Portal
- Swiggy API on API Tracker
- Community Swiggy API Projects (GitHub)
- Swiggy Tech Blog
Labels
enhancement, integration, new-feature