import { tavily } from "@tavily/core"; import { writeFileSync } from "fs"; const client = tavily({ apiKey: process.env.TAVILY_API_KEY }); async function runQueries() { const queries = [ { query_id: 1, query_name: "Industry Trends & Market Landscape", search_terms: "mood tracking app market 2026 mental health app trends CBT guided journaling AI insights", options: { searchDepth: "advanced", topic: "news", days: 30, maxResults: 10, excludeDomains: ["pinterest.com", "etsy.com"] } }, { query_id: 2, query_name: "Competitor Analysis", search_terms: "Daylio vs Finch vs Bearable vs How We Feel mood tracker 2026 marketing campaigns features comparison", options: { searchDepth: "advanced", topic: "general", maxResults: 10, includeDomains: ["reddit.com", "producthunt.com", "techcrunch.com", "theverge.com", "cnet.com", "choosingtherapy.com"] } }, { query_id: 3, query_name: "Audience Pain Points & Conversations", search_terms: "mood tracking app frustrations blank journal overwhelm therapist homework mood diary share with therapist 2025 2026", options: { searchDepth: "advanced", topic: "general", maxResults: 10, includeDomains: ["reddit.com", "twitter.com", "quora.com"] } }, { query_id: 4, query_name: "High-Performing Hooks & Ad Copy", search_terms: "best mental health app ad copy hooks 2026 wellness app Instagram TikTok ad examples high engagement", options: { searchDepth: "advanced", topic: "general", maxResults: 10 } }, { query_id: 5, query_name: "Viral Content & Cultural Moments", search_terms: "mental health app viral TikTok 2026 spring self-care trend therapy journal check-in cultural moment", options: { searchDepth: "advanced", topic: "news", days: 14, maxResults: 10 } } ]; const results = []; for (const q of queries) { console.log(`\nšŸ” Query ${q.query_id}: ${q.query_name}`); console.log(` Search: "${q.search_terms}"`); try { const res = await client.search(q.search_terms, q.options); console.log(` āœ… Got ${res.results?.length || 0} results`); results.push({ ...q, raw_results: res.results || [], answer: res.answer || null }); } catch (err) { console.error(` āŒ Error: ${err.message}`); results.push({ ...q, raw_results: [], answer: null, error: err.message }); } } // Write raw results for processing const outputPath = "outputs/reflect_v1.1_—_guided_reflection_&_ai_reports_20260325/raw_research.json"; writeFileSync(outputPath, JSON.stringify(results, null, 2)); console.log(`\nāœ… Raw results saved to ${outputPath}`); } runQueries().catch(console.error);