A RESTful API for AdTurbo, an SaaS platform that simplifies ads traffic management, optimization, and automation.
This API provides the backend services needed for AdFlow to interact with Meta Ads. It handles authentication, campaign management, analytics, and automation through the Meta Marketing API.
- OAuth 2.0 integration with Meta platforms
- Campaign monitoring and management
- Automated rules engine for campaign optimization
- Performance analytics and insights
- Creative management and A/B testing
- Webhook handlers for real-time updates
- Node.js 18+
- PostgreSQL 16+
- Redis 6+
- TypeORM
The API follows a modular architecture:
- Auth Module: OAuth flow and token management
- Ad Accounts Module: Management of advertising accounts
- Campaigns Module: Campaign CRUD operations
- Analytics Module: Performance metrics and reporting
- Automation Module: Rules engine and automated actions
- Creative Module: Ad creative management and generation
The API implements Meta's OAuth 2.0 flow for secure authentication:
- Users authorize AdFlow to access their Meta Ads accounts
- Secure token storage and management
- Automatic token refresh
- JWT-based authentication for client applications
GET /auth/meta: Initiates Meta OAuth flowGET /auth/meta/callback: OAuth callback handlerPOST /auth/refresh: Refresh access tokensGET /auth/status: Check authentication status
GET /accounts: List connected ad accountsGET /accounts/:id: Get account detailsPOST /accounts/:id/sync: Sync account data
GET /campaigns: List campaignsGET /campaigns/:id: Get campaign detailsPOST /campaigns: Create new campaignPUT /campaigns/:id: Update campaignPOST /campaigns/:id/duplicate: Duplicate campaignPUT /campaigns/:id/status: Update campaign status
GET /adsets: List ad setsGET /ads: List adsGET /ads/:id: Get ad detailsPOST /ads: Create new adPUT /ads/:id: Update ad
GET /analytics/performance: Get performance metricsGET /analytics/insights: Get campaign insightsGET /analytics/reports: Generate custom reports
GET /automation/rules: List automation rulesPOST /automation/rules: Create automation ruleGET /automation/logs: Get automation logsPOST /automation/actions/execute: Execute manual action
GET /creatives: List ad creativesPOST /creatives: Create new creativePOST /creatives/generate: Generate creative variations with AI
ads_management: For creating/updating campaignsads_read: For reading campaign databusiness_management: For account accesspages_read_engagement: For Page integration
The API supports Meta webhooks for real-time updates:
- Campaign status changes
- Performance threshold notifications
- Budget consumption alerts
Primary entities in the database:
users: User accountsaccounts: Meta account connectionsad_accounts: Advertising accountscampaigns: Ad campaignsad_sets: Sets of adsads: Individual adscreatives: Ad creativesmetrics: Performance metricsautomation_rules: Automation rule configurationsautomation_logs: Automation execution logs
- Unified Dashboard: Single view for Meta Ads and Google Ads campaigns
- Performance Metrics: Real-time ROAS, CPC, CTR, and conversion tracking
- Campaign Automation: Rules-based optimization for budget allocation
- Alert System: Notification when campaigns under/over perform set thresholds
- Performance Prediction: Early identification of high-potential ad creatives
- Budget Allocation: Smart suggestions for redistribution based on ROAS
- A/B Testing: Automated test creation and statistical analysis
- Audience Insights: AI-driven audience segmentation recommendations
- Ad Variation Generator: Create multiple ad versions with a single click
- Copy Wizard: AI-generated ad copy based on high-performing patterns
- Creative Library: Organized repository of all ad creatives with performance metrics
- Performance Analysis: Identify which visual and copy elements drive conversions
- Customizable Reports: Build and schedule reports with drag-and-drop simplicity
- Multi-channel Attribution: Track customer journey across platforms
- Export Options: PDF, CSV, and direct integration with Google Sheets
- Benchmark Comparisons: Compare performance against industry standards
The platform uses advanced natural language processing to:
- Analyze high-converting ad copies across industries
- Generate variations with different psychological triggers (urgency, scarcity, etc.)
- Optimize headlines and descriptions based on audience response
- Adapt messaging to match campaign objectives
Our prediction engine leverages machine learning to:
- Forecast campaign performance based on historical data
- Identify underperforming ads before they waste significant budget
- Suggest optimal audience segments for specific offerings
- Predict seasonal trends and recommend proactive adjustments
The AI insight system automatically:
- Identifies patterns in successful campaigns
- Generates actionable recommendations in plain language
- Highlights anomalies and opportunities
- Explains the "why" behind performance changes
- TikTok Ads integration
- Advanced creative analysis (visual element recognition)
- Enhanced mobile experience
- Custom automation templates
- LinkedIn and Pinterest Ads integration
- Collaborative workspace for agencies
- Marketplace for ad templates
- Advanced funnel analytics
- Predictive budget planning
- Competitive intelligence features
- Custom ML models per account
- Native video creation tools
- Cross-platform audience synchronization
- Microservices architecture for feature isolation
- Horizontal scaling for API processing
- Data warehousing solution for analytics at scale
- Background job processing for report generation
- Knowledge base with step-by-step tutorials
- Community forum for strategy sharing
- Weekly webinars on platform features
- Priority support for Pro and Enterprise plans