11 const path = url.pathname;
12
13 // Forward API requests to the leads API
14 if (path.startsWith("/api/")) {
15 const leadsHandler = (await import("./leads.ts")).default;
16 return await leadsHandler.handler(req);
571
572 try {
573 const response = await fetch('/api/leads', {
574 method: 'POST',
575 headers: {
601 try {
602 // Get lead data
603 const response = await fetch('/api/leads?id=' + leadId);
604 const result = await response.json();
605
653
654 try {
655 const response = await fetch('/api/leads', {
656 method: 'PUT',
657 headers: {
705
706 try {
707 const response = await fetch('/api/leads', {
708 method: 'PUT',
709 headers: {
16 // like the sender and the message text
17 const result = await fetchJSON(
18 "https://slack.com/api/chat.postMessage",
19 {
20 headers: {
27});
28
29// API endpoint to update username
30app.post("/api/user/username", async c => {
31 const user = c.get("user");
32
16 console.log("👤 Lead Management: https://prashamtrivedi--b3b406582c1111f080de569c3dd06744.web.val.run");
17 console.log("📝 Log Entries: https://prashamtrivedi--f1bc92542c1011f0bb1f569c3dd06744.web.val.run/log");
18 console.log("🔄 API Endpoints:");
19 console.log(" - Log Entry: https://prashamtrivedi--afdccfb62c1011f0b351569c3dd06744.web.val.run");
20 console.log(" - Todo Management: https://prashamtrivedi--694775142c1111f08a2b569c3dd06744.web.val.run");
32- ValTown serverless functions
33- SQLite database for persistent storage
34- OpenAI API for AI-powered analysis and recommendations
35- Email integration for notifications
36- Browser-based dashboard with interactive UI
43
44 try {
45 const response = await fetch("/api/user/username", {
46 method: "POST",
47 headers: {
40
41/**
42 * Fetches tasks from Todoist API
43 * @returns Array of Todoist tasks due today or overdue
44 */
45async function fetchTodoistTasks(): Promise<TodoistTask[]> {
46 const apiToken = Deno.env.get("TODOIST_API_TOKEN");
47
48 if (!apiToken) {
49 throw new Error("Todoist API Token is required");
50 }
51
55
56 try {
57 const response = await fetch("https://api.todoist.com/rest/v2/tasks", {
58 method: "GET",
59 headers: {
60 "Authorization": `Bearer ${apiToken}`,
61 "Content-Type": "application/json",
62 },
64
65 if (!response.ok) {
66 throw new Error(`Todoist API error: ${response.statusText}`);
67 }
68
30 // This is a no-op if nothing's changed
31 if (!isEndpointSet) {
32 await bot.api.setWebhook("https://omnipotente.val.run/telegramBotStarter", {
33 secret_token: SECRET_TOKEN,
34 });
93
94export async function sendDailyBriefing(today?: DateTime) {
95 // Get API keys from environment
96 const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
97 // const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
98
102 // }
103
104 if (!apiKey) {
105 console.error("Anthropic API key is not configured.");
106 return;
107 }
118
119 // Initialize Anthropic client
120 const anthropic = new Anthropic({ apiKey });
121
122 // Initialize Telegram bot
166
167 // disabled title for now, it seemes unnecessary...
168 // await bot.api.sendMessage(chatId, `*${title}*`, { parse_mode: "Markdown" });
169
170 // Then send the main content
174
175 if (content.length <= MAX_LENGTH) {
176 await bot.api.sendMessage(chatId, content, { parse_mode: "Markdown" });
177 // Store the briefing in chat history
178 await storeChatMessage(
203 // Send each chunk as a separate message and store in chat history
204 for (const chunk of chunks) {
205 await bot.api.sendMessage(chatId, chunk, { parse_mode: "Markdown" });
206 // Store each chunk in chat history
207 await storeChatMessage(
6 <title>Gorilla Rampage: Meta & Mayhem</title>
7 <script src="https://cdn.tailwindcss.com"></script>
8 <link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
9 <style>
10 body {