File size: 22,600 Bytes
4484c0f
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{"instruction": "What is the SaaS configurator in GoHighLevel and how do I use it?", "output": "**GoHighLevel SaaS Configurator**\n\nThe SaaS Configurator allows agencies to create white-labeled SaaS offerings:\n\n**Key Features:**\n1. **Branding Control**: Custom domain, logo, colors, favicon\n2. **Feature Gating**: Enable/disable features per plan tier\n3. **Pricing Configuration**: Set monthly/annual pricing for clients\n4. **Rebilling Markup**: Configure markup on SMS, calls, emails\n\n**Setup Steps:**\n1. Agency Settings β†’ SaaS Configurator\n2. Create pricing tiers (Starter, Pro, Enterprise)\n3. Define feature access per tier\n4. Set rebilling markups\n5. Configure Stripe for automated billing\n6. Generate client signup links\n\n**Common Use Cases:**\n- Marketing agencies selling CRM access\n- Consultants offering automation platforms\n- Franchises with branded portals", "metadata": {"platform": "gohighlevel", "feature": "saas_configurator", "visual": true}}
{"instruction": "How do I set up automation workflows in GoHighLevel?", "output": "**GoHighLevel Workflow Automation**\n\nNavigate to: Automation → Workflows\n\n**Workflow Components:**\n\n**1. Triggers (Starting Points)**\n- Form Submitted\n- Appointment Booked/Cancelled\n- Tag Added/Removed\n- Pipeline Stage Changed\n- Invoice Paid\n- Birthday/Custom Date\n- Inbound Call\n- Email Opened/Clicked\n- Webhook Received\n\n**2. Actions (What Happens)**\n- Send Email/SMS\n- Add/Remove Tag\n- Update Contact Field\n- Move to Pipeline Stage\n- Create Opportunity\n- Assign to User\n- Wait/Delay\n- IF/ELSE Conditions\n- Webhook Call\n\n**Best Practices:**\n1. Name workflows descriptively\n2. Use folders for organization\n3. Test with dummy data first\n4. Enable 'Execute Once' for triggered actions\n5. Set up error notifications\n\n**Example: Lead Nurture Sequence**\n```\nTrigger: Form Submitted (Contact Form)\n→ Wait 5 minutes\n→ Send Email: Welcome\n→ Wait 1 day\n→ Send SMS: Did you receive our email?\n→ Wait 3 days\n→ IF no reply → Assign to Sales Rep\n```", "metadata": {"platform": "gohighlevel", "feature": "workflows", "visual": true}}
{"instruction": "How do I manage opportunities and sales pipelines in GoHighLevel?", "output": "**GoHighLevel Pipeline Management**\n\nNavigate to: Opportunities\n\n**Pipeline Views:**\n- **Kanban**: Drag-and-drop cards between stages\n- **List**: Table view with filtering/sorting\n- **Calendar**: View by expected close date\n\n**Creating Pipelines:**\n1. Go to Opportunities β†’ Pipelines tab\n2. Click 'Add Pipeline'\n3. Define stages (e.g., Lead, Qualified, Proposal, Negotiation, Won, Lost)\n4. Set stage colors and icons\n5. Configure automation triggers per stage\n\n**Opportunity Card Fields:**\n- Monetary Value\n- Expected Close Date\n- Assigned User\n- Contact Information\n- Custom Fields\n- Activity History\n- Notes and Files\n\n**Pipeline Automation Ideas:**\n| Stage Change | Automation |\n|--------------|------------|\n| β†’ Qualified | Assign to sales rep, send intro email |\n| β†’ Proposal | Create task for follow-up |\n| β†’ Won | Send thank you email, create invoice |\n| β†’ Lost | Add to re-engagement nurture |\n\n**Reporting:**\n- Pipeline value by stage\n- Conversion rates stage-to-stage\n- Revenue forecasting\n- Rep performance metrics", "metadata": {"platform": "gohighlevel", "feature": "pipelines", "visual": true}}
{"instruction": "What integrations are available in GoHighLevel?", "output": "**GoHighLevel Integrations Hub**\n\nNavigate to: Settings β†’ Integrations\n\n**Built-in Integrations:**\n\n| Category | Integrations |\n|----------|-------------|\n| **Payment** | Stripe, PayPal, Authorize.net |\n| **Calendar** | Google Calendar, Outlook, iCloud |\n| **Email** | Gmail, Outlook, Mailgun, SMTP |\n| **Social** | Facebook, Instagram, LinkedIn, TikTok |\n| **Ads** | Facebook Ads, Google Ads |\n| **Accounting** | QuickBooks, Xero |\n| **CRM Import** | HubSpot, Salesforce, Pipedrive |\n| **Communication** | Twilio, LeadConnector |\n| **Analytics** | Google Analytics, Facebook Pixel |\n| **Zoom** | Video conferencing for appointments |\n\n**API Access:**\n- Full REST API for custom integrations\n- Zapier/Make connections available\n- Webhook support for real-time events\n\n**OAuth Apps (Premium):**\n- Build custom marketplace apps\n- Sell integrations to other agencies\n- Revenue sharing with GHL\n\n**Tip:** Always test integrations in a sub-account before rolling out agency-wide.", "metadata": {"platform": "gohighlevel", "feature": "integrations", "visual": true}}
{"instruction": "How do I set up warehouse operations in Odoo Inventory?", "output": "**Odoo Warehouse Operations Setup**\n\nNavigate to: Inventory β†’ Configuration β†’ Warehouses\n\n**Warehouse Structure:**\n```\nWarehouse (WH)\nβ”œβ”€β”€ Input Zone (WH/Input)\nβ”‚   └── Quality Control (WH/Input/QC)\nβ”œβ”€β”€ Stock (WH/Stock)\nβ”‚   β”œβ”€β”€ Zone A (Fast movers)\nβ”‚   β”œβ”€β”€ Zone B (Medium movers)\nβ”‚   └── Zone C (Slow movers)\n└── Output Zone (WH/Output)\n    └── Packing (WH/Output/Pack)\n```\n\n**Setting Up Routes:**\n1. Go to Inventory β†’ Configuration β†’ Routes\n2. Create routes for:\n   - Buy β†’ Receive β†’ Stock\n   - Pick β†’ Pack β†’ Ship\n   - Cross-dock (direct to output)\n\n**Operation Types:**\n| Type | Purpose |\n|------|---------|\n| Receipts | Incoming goods |\n| Deliveries | Outgoing shipments |\n| Internal Transfers | Warehouse moves |\n| Manufacturing | Production orders |\n\n**Automation Options:**\n- Auto-reserve stock on order confirmation\n- Automatic reordering at min quantity\n- Wave picking for batch processing\n- Barcode scanning integration", "metadata": {"platform": "odoo", "module": "inventory", "visual": true}}
{"instruction": "How do I configure products with variants in Odoo?", "output": "**Odoo Product Variants Configuration**\n\nNavigate to: Inventory → Products → Products\n\n**Enabling Variants:**\n1. Go to Settings → Inventory\n2. Enable 'Variants'\n3. Create attribute types\n\n**Creating Attributes:**\n```\nAttribute: Color\nValues: Red, Blue, Green, Black\n\nAttribute: Size\nValues: S, M, L, XL\n\nAttribute: Material\nValues: Cotton, Polyester, Blend\n```\n\n**Variant Creation Modes:**\n- **Instantly**: Creates all combinations immediately\n- **Dynamically**: Creates on-demand when ordered\n\n**Example Product:**\n```\nProduct: T-Shirt\nAttributes: Color (3) × Size (4) = 12 variants\n\nSKU Pattern: TSHIRT-{COLOR}-{SIZE}\n→ TSHIRT-RED-S, TSHIRT-RED-M, etc.\n```\n\n**Variant-Specific Settings:**\n- Individual pricing per variant\n- Separate inventory tracking\n- Unique barcodes\n- Different suppliers\n- Variant-level images\n\n**Best Practices:**\n1. Use variant-level tracking for sizing\n2. Group by product for reporting\n3. Set default variant for quick entry", "metadata": {"platform": "odoo", "module": "products", "visual": true}}
{"instruction": "How do I set up multi-company accounting in Odoo?", "output": "**Odoo Multi-Company Accounting**\n\nNavigate to: Settings β†’ Users β†’ Companies\n\n**Setup Process:**\n\n**1. Create Companies**\n```\nParent Company: ABC Holdings\nβ”œβ”€β”€ Subsidiary 1: ABC Manufacturing\nβ”œβ”€β”€ Subsidiary 2: ABC Retail\n└── Subsidiary 3: ABC Services\n```\n\n**2. Configure Chart of Accounts**\nEach company needs its own:\n- Chart of Accounts\n- Fiscal Year settings\n- Tax configuration\n- Bank accounts\n\n**3. Inter-Company Transactions**\nEnable: Settings β†’ General Settings β†’ Inter-Company Transactions\n\nAuto-creates:\n- Purchase Order ↔ Sales Order\n- Invoices ↔ Bills\n- Journal entries for reconciliation\n\n**4. User Access**\n- Users can belong to multiple companies\n- Permission per company possible\n- Switch companies in top-right dropdown\n\n**Consolidated Reporting:**\n```\nConsolidation Company (ABC Holdings)\n  ↓\nAggregates financials from all subsidiaries\n  ↓\nElimination entries for inter-company\n  ↓\nConsolidated P&L, Balance Sheet\n```\n\n**Tips:**\n- Use same currency for consolidation\n- Match fiscal periods across companies\n- Standardize COA numbering", "metadata": {"platform": "odoo", "module": "accounting", "visual": true}}
{"instruction": "Show me a complete eCommerce automation project using n8n", "output": "**Case Study: eCommerce Order Fulfillment Automation**\n\n**Client:** Mid-sized DTC fashion brand\n**Challenge:** Manual order processing causing 48-hour fulfillment delays\n**Solution:** End-to-end n8n automation\n\n---\n\n**Before Automation:**\n- Staff manually copying Shopify orders to spreadsheet\n- Warehouse team printing pick lists by hand\n- No inventory sync between platforms\n- Customer service responding to \"where's my order\" manually\n\n**Automation Architecture:**\n```\nShopify Order Created\n    ↓\nn8n Webhook captures order\n    ↓\nValidate inventory (check Shopify + WMS)\n    ↓\nIF in stock:\n  β†’ Create shipping label (ShipStation)\n  β†’ Update order status\n  β†’ Send confirmation email\nELSE:\n  β†’ Backorder notification\n  β†’ Add to restock queue\n    ↓\nTrack shipment status\n    ↓\nSend delivery notification\n```\n\n**Workflows Built:**\n1. Order Processing (main flow)\n2. Inventory Sync (Shopify ↔ Warehouse)\n3. Customer Communication (5-email sequence)\n4. Return Processing\n5. Analytics Dashboard Update\n\n**Results (After 90 Days):**\n| Metric | Before | After | Improvement |\n|--------|--------|-------|-------------|\n| Fulfillment time | 48 hrs | 4 hrs | 92% faster |\n| Manual data entry | 6 hrs/day | 0 hrs | 100% eliminated |\n| Shipping errors | 5%/week | 0.2%/week | 96% reduction |\n| WISMO tickets | 120/week | 15/week | 87% reduction |\n\n**ROI:** $180,000/year saved in labor + error costs", "metadata": {"type": "case_study", "industry": "ecommerce", "complexity": "advanced"}}
{"instruction": "How do I calculate ROI for automation projects?", "output": "**Automation ROI Calculator Framework**\n\n**Formula:**\n```\nROI = (Annual Savings - Implementation Cost) / Implementation Cost Γ— 100%\n```\n\n**Step 1: Measure Current State**\n\n| Manual Task | Time/Week | Hourly Rate | Weekly Cost |\n|-------------|-----------|-------------|-------------|\n| Data entry | 10 hrs | $25 | $250 |\n| Report generation | 5 hrs | $35 | $175 |\n| Email follow-ups | 8 hrs | $25 | $200 |\n| Error corrections | 3 hrs | $40 | $120 |\n| **Total** | **26 hrs** | | **$745/week** |\n\n**Annual manual cost: $745 Γ— 52 = $38,740**\n\n**Step 2: Calculate Implementation Cost**\n\n| Item | Cost |\n|------|------|\n| n8n setup (self-hosted) | $0 - $500 |\n| Development time (40 hrs @ $100) | $4,000 |\n| n8n Cloud (if applicable) | $50/month = $600/year |\n| Maintenance (5 hrs/month @ $100) | $6,000/year |\n| **Total Year 1** | **$11,100** |\n\n**Step 3: Estimate Post-Automation**\n\n| Remaining Manual Work | Time/Week | Cost |\n|-----------------------|-----------|------|\n| Exception handling | 2 hrs | $50 |\n| Oversight/monitoring | 1 hr | $35 |\n| **Total** | **3 hrs** | **$85/week** |\n\n**Annual post-automation cost: $85 Γ— 52 = $4,420**\n\n**Step 4: Calculate ROI**\n```\nAnnual Savings = $38,740 - $4,420 = $34,320\nYear 1 ROI = ($34,320 - $11,100) / $11,100 Γ— 100% = 209%\nPayback Period = 4 months\n```\n\n**Intangible Benefits:**\n- Faster processing (customer satisfaction)\n- Fewer errors (brand reputation)\n- Scalability (handle 10x volume)\n- Employee focus on high-value work", "metadata": {"type": "case_study", "topic": "roi_calculation", "complexity": "intermediate"}}
{"instruction": "Show me a before/after comparison of a marketing automation implementation", "output": "**Before/After: Marketing Agency Automation**\n\n**Agency Profile:**\n- 15-person digital marketing agency\n- 40+ active clients\n- Services: Social media, email, paid ads\n\n---\n\n## BEFORE (Manual Processes)\n\n**Daily Routine:**\n```\n8:00 AM - Check all client Facebook pages manually\n9:00 AM - Download analytics from each platform\n10:00 AM - Build reports in spreadsheets\n11:00 AM - Send reports via email\n1:00 PM - Schedule social posts (Hootsuite)\n3:00 PM - Check lead forms, enter into CRMs\n4:00 PM - Send follow-up emails to leads\n5:00 PM - Update project management boards\n```\n\n**Pain Points:**\n- 4 hours/day on repetitive tasks per person\n- Inconsistent reporting formats\n- Leads going cold (24-48hr response time)\n- Human errors in data entry\n- No time for strategy work\n\n---\n\n## AFTER (n8n Automation)\n\n**Automated Workflows:**\n\n**1. Social Media Management**\n```\nSchedule: Every day 8 AM\n→ Check content calendar (Google Sheets)\n→ Pull approved posts\n→ Post to FB, IG, LinkedIn, Twitter\n→ Log performance to dashboard\n```\n\n**2. Lead Capture & Distribution**\n```\nTrigger: Form submission (any client)\n→ Identify client from form source\n→ Add to client's CRM (HubSpot/GHL/Salesforce)\n→ Send instant SMS: \"We'll call in 5 minutes\"\n→ Assign to available sales rep\n→ Create follow-up task\n```\n\n**3. Client Reporting**\n```\nSchedule: Every Friday 9 AM\n→ Pull metrics from all sources\n→ Generate client-specific PDF report\n→ Email to client with commentary\n→ Update master dashboard\n```\n\n**Results Comparison:**\n\n| Metric | Before | After |\n|--------|--------|-------|\n| Time on manual tasks | 4 hrs/day/person | 30 min/day |\n| Lead response time | 24-48 hrs | < 5 minutes |\n| Report generation | 2 hrs/client/month | 0 (automated) |\n| Client capacity | 40 clients | 100+ clients |\n| Billable hours | 60% | 85% |\n\n**Revenue Impact:**\n- Same team now handles 2.5x clients\n- $400K additional annual revenue\n- Client retention improved 35%", "metadata": {"type": "case_study", "industry": "marketing_agency", "complexity": "intermediate"}}
{"instruction": "How do I build automated dashboards with n8n?", "output": "**Automated Dashboard Building with n8n**\n\n**Architecture:**\n```\nData Sources β†’ n8n (ETL) β†’ Data Store β†’ Visualization Tool\n```\n\n**Step 1: Data Collection Workflow**\n```javascript\n// Scheduled data refresh\nconst [\n  salesData,\n  marketingData,\n  supportData\n] = await Promise.all([\n  stripe.charges.list({ created: { gte: startOfMonth } }),\n  googleAnalytics.getData({ metrics: ['sessions', 'conversions'] }),\n  zendesk.tickets.list({ status: 'closed', created: '>30d' })\n]);\n\n// Transform and aggregate\nconst dashboard = {\n  revenue: salesData.reduce((s, c) => s + c.amount, 0) / 100,\n  newCustomers: salesData.filter(c => c.metadata.isNew).length,\n  webSessions: marketingData.sessions,\n  conversionRate: (marketingData.conversions / marketingData.sessions * 100).toFixed(2),\n  ticketsResolved: supportData.length,\n  avgResolutionTime: calculateAvgTime(supportData)\n};\n```\n\n**Step 2: Store in Google Sheets**\n```javascript\nawait googleSheets.appendRow({\n  spreadsheetId: 'dashboard-data',\n  range: 'DailyMetrics',\n  values: [[\n    new Date().toISOString(),\n    dashboard.revenue,\n    dashboard.newCustomers,\n    dashboard.webSessions,\n    dashboard.conversionRate\n  ]]\n});\n```\n\n**Step 3: Visualization Options**\n\n| Tool | Integration | Best For |\n|------|-------------|----------|\n| Google Data Studio | Direct Sheets connection | Free, easy |\n| Tableau | API push or database | Enterprise |\n| Grafana | Database, Prometheus | Real-time |\n| Metabase | Database | Open-source |\n\n**Alerting Layer:**\n```javascript\n// Alert on anomalies\nif (dashboard.revenue < lastWeekAvg * 0.7) {\n  await slack.send({\n    channel: '#alerts',\n    text: `⚠️ Revenue 30% below last week average`\n  });\n}\n```", "metadata": {"category": "analytics", "use_case": "dashboards", "complexity": "intermediate"}}
{"instruction": "How do I track KPIs automatically with n8n?", "output": "**Automated KPI Tracking System**\n\n**1. Define Your KPIs**\n```javascript\nconst kpiConfig = {\n  financial: [\n    { name: 'MRR', source: 'stripe', formula: 'sum(subscriptions.amount)' },\n    { name: 'Churn Rate', source: 'stripe', formula: 'cancelled/total * 100' },\n    { name: 'LTV', source: 'stripe', formula: 'avgRevenue * avgLifespan' }\n  ],\n  marketing: [\n    { name: 'CAC', source: 'multi', formula: 'adSpend / newCustomers' },\n    { name: 'Lead Velocity', source: 'crm', formula: 'thisMonth.leads - lastMonth.leads' },\n    { name: 'MQLβ†’SQL Conversion', source: 'crm', formula: 'sql / mql * 100' }\n  ],\n  product: [\n    { name: 'DAU', source: 'analytics', formula: 'activeUsers' },\n    { name: 'Feature Adoption', source: 'analytics', formula: 'featureUsers / totalUsers' },\n    { name: 'NPS', source: 'surveys', formula: 'promoters - detractors' }\n  ]\n};\n```\n\n**2. Collection Workflow**\n```\nSchedule: Daily at 6 AM\n    ↓\nFOR each KPI category:\n  β†’ Fetch data from source\n  β†’ Calculate metric\n  β†’ Compare to target\n  β†’ Store history\n    ↓\nGenerate summary report\n    ↓\nDistribute to stakeholders\n```\n\n**3. Trend Analysis**\n```javascript\n// Calculate week-over-week change\nconst currentValue = kpi.value;\nconst previousValue = await db.query(\n  'SELECT value FROM kpi_history WHERE name = $1 AND date = $2',\n  [kpi.name, oneWeekAgo]\n);\n\nconst trend = {\n  direction: currentValue > previousValue ? 'up' : 'down',\n  change: ((currentValue - previousValue) / previousValue * 100).toFixed(1),\n  status: currentValue >= kpi.target ? 'on_track' : 'behind'\n};\n```\n\n**4. Executive Summary Email**\n```\nSubject: Daily KPIs - January 1, 2026\n\nπŸ“Š Key Metrics Summary:\n━━━━━━━━━━━━━━━━━━━━━━\nβœ… MRR: $125,000 (+5% WoW)\nβœ… DAU: 15,234 (+12% WoW)\n⚠️ CAC: $125 (+8% WoW - above target)\n❌ Churn: 3.2% (target: 2.5%)\n\n[View Full Dashboard]\n```", "metadata": {"category": "analytics", "use_case": "kpi_tracking", "complexity": "intermediate"}}
{"instruction": "How do I build appointment booking automation with n8n?", "output": "**Appointment Booking Automation**\n\n**Complete Booking Flow:**\n```\n1. Customer books via calendar link\n2. n8n receives booking webhook\n3. Validate no conflicts\n4. Send confirmation (email + SMS)\n5. Add to Google Calendar\n6. Create CRM record\n7. Schedule reminders\n8. Post-appointment follow-up\n```\n\n**1. Webhook Handler**\n```javascript\n// Calendly/Cal.com webhook\nconst booking = $input.first().json;\n\nconst appointmentData = {\n  clientName: booking.invitee.name,\n  clientEmail: booking.invitee.email,\n  clientPhone: booking.questions_and_answers.find(q => q.question === 'Phone')?.answer,\n  dateTime: booking.event.start_time,\n  duration: booking.event.duration,\n  service: booking.event_type.name,\n  staffMember: booking.event.host.email\n};\n```\n\n**2. Multi-Channel Confirmation**\n```javascript\n// Email confirmation\nawait sendEmail({\n  to: appointmentData.clientEmail,\n  subject: `Appointment Confirmed: ${formatDate(appointmentData.dateTime)}`,\n  template: 'appointment_confirmation',\n  data: appointmentData\n});\n\n// SMS confirmation\nawait twilio.sendSms({\n  to: appointmentData.clientPhone,\n  body: `Your appointment is confirmed for ${formatDateTime(appointmentData.dateTime)}. Reply CONFIRM to acknowledge.`\n});\n```\n\n**3. Reminder Schedule**\n```\n24 hours before:\n  β†’ Email reminder with prep instructions\n  β†’ Calendar notification\n\n2 hours before:\n  β†’ SMS reminder\n\n30 minutes before (for virtual):\n  β†’ Send meeting link\n```\n\n**4. No-Show Handling**\n```javascript\n// Check for check-in 15 min after start\nconst checkedIn = await checkAppointmentStatus(appointmentId);\n\nif (!checkedIn) {\n  await markAsNoShow(appointmentId);\n  await sendNoShowFollowup(appointmentData);\n  await rescheduleLink(appointmentData.clientEmail);\n}\n```\n\n**5. Post-Appointment Automation**\n- Send thank you email\n- Request review/feedback\n- Schedule follow-up appointment\n- Update CRM with notes", "metadata": {"category": "scheduling", "use_case": "appointment_booking", "complexity": "intermediate"}}
{"instruction": "How do I set up resource scheduling automation?", "output": "**Resource Scheduling Automation with n8n**\n\n**Use Cases:**\n- Equipment booking (conference rooms, vehicles, machinery)\n- Staff shift scheduling\n- Facility reservations\n\n**1. Resource Availability Check**\n```javascript\n// Check if resource is available\nasync function checkAvailability(resourceId, startTime, endTime) {\n  const conflicts = await db.query(`\n    SELECT * FROM bookings\n    WHERE resource_id = $1\n    AND start_time < $3\n    AND end_time > $2\n  `, [resourceId, startTime, endTime]);\n  \n  return conflicts.length === 0;\n}\n\nconst isAvailable = await checkAvailability(\n  resource.id,\n  requestedStart,\n  requestedEnd\n);\n\nif (!isAvailable) {\n  // Find next available slot\n  const nextSlot = await findNextAvailable(resource.id, requestedStart);\n  return { available: false, suggestion: nextSlot };\n}\n```\n\n**2. Booking Creation Flow**\n```\nRequest Received\n    ↓\nCheck Resource Availability\n    ↓\nIF available:\n  β†’ Create Booking Record\n  β†’ Block Calendar Time\n  β†’ Send Confirmation\n  β†’ Schedule Prep/Cleanup Time\nELSE:\n  β†’ Suggest Alternatives\n  β†’ Add to Waitlist (optional)\n```\n\n**3. Conflict Prevention**\n```javascript\n// Database-level lock to prevent double booking\nawait db.transaction(async (trx) => {\n  // Lock the resource row\n  await trx.raw('SELECT * FROM resources WHERE id = $1 FOR UPDATE', [resourceId]);\n  \n  // Recheck availability inside transaction\n  const conflicts = await trx.select().from('bookings')\n    .where('resource_id', resourceId)\n    .whereBetween('start_time', [start, end]);\n    \n  if (conflicts.length > 0) {\n    throw new Error('Resource became unavailable');\n  }\n  \n  // Create booking\n  await trx.insert({\n    resource_id: resourceId,\n    user_id: userId,\n    start_time: start,\n    end_time: end\n  }).into('bookings');\n});\n```\n\n**4. Utilization Reporting**\n```javascript\n// Weekly resource utilization report\nconst utilization = await db.query(`\n  SELECT \n    r.name as resource,\n    COUNT(b.id) as bookings,\n    SUM(EXTRACT(EPOCH FROM (b.end_time - b.start_time))) / 3600 as hours_used,\n    (SUM(EXTRACT(EPOCH FROM (b.end_time - b.start_time))) / \n     (7 * 24 * 3600) * 100) as utilization_pct\n  FROM resources r\n  LEFT JOIN bookings b ON r.id = b.resource_id\n  WHERE b.start_time >= $1\n  GROUP BY r.id\n`, [weekStart]);\n```", "metadata": {"category": "scheduling", "use_case": "resource_booking", "complexity": "advanced"}}