Overview
This application allows users to connect their Facebook or Instagram accounts to automatically fetch advertising campaign analytics. Once connected, the app collects and aggregates campaign data using a fully serverless backend.
The analytics are visualized using interactive charts, and users can ask questions about their performance using an AI assistant powered by large language models, providing marketing insights directly from the aggregated data.
Features
- OAuth-based social media account integration (Facebook, Instagram)
- Scheduled data fetching and syncing of campaign analytics
- Aggregated campaign performance metrics (CTR, CPM, Reach, etc.)
- Interactive dashboard with real-time graphs and KPIs
- AI-powered insights (e.g., “Why did my reach drop last week?”)
- Fully serverless architecture using AWS Lambda, SQS, and DynamoDB
- Auto-scaling and cost-efficient infrastructure
System Design
High-Level Data Integration Design
The application connects to various advertising platforms (e.g., Facebook, Instagram) through authenticated integrations. The architecture ensures scalable and asynchronous data processing using serverless components.

- Users connect their social media ad accounts via OAuth.
- The system stores the credentials/tokens securely (e.g., in AWS Secrets Manager or DynamoDB).
- Scheduled tasks are run daily to fetch data from each connected account.
Scheduled Data Collection with AWS Lambda and SQS
Every midnight, a scheduled Lambda function is triggered by a cron-based event rule. This function:
- Checks which SMEs (small/medium enterprises) have connected their advertising accounts.
- Publishes messages to Amazon SQS, one for each connected SME.
Each message contains the metadata needed to fetch data (e.g., token, account ID, platform). Then, a data-fetching Lambda subscribes to this queue, processes each message, and:
- Calls the advertising platform API (e.g., Facebook Ads API).
- Normalizes and stores the campaign analytics in DynamoDB.

This approach ensures fault tolerance, retry handling, and parallel processing of multiple clients efficiently.