Build a daily summary
A short script that reads yesterday’s calls, urgent messages and unanswered questions.
Three reads make a useful morning digest. Run this once a day from a scheduler and send the text wherever your team reads things.
daily-summary
const API = 'https://app.prepaid.ai/api/v1';const headers = { Authorization: `Bearer ${process.env.PREPAID_API_KEY}` };const get = async (path) => { const res = await fetch(API + path, { headers }); if (!res.ok) throw new Error(`${path} answered ${res.status}`); return res.json();};const since = Date.now() - 24 * 60 * 60 * 1000;const { calls } = await get('/calls?limit=200');const today = calls.filter((c) => Date.parse(c.startedAt) >= since);const { messages } = await get('/messages?urgent_only=true');const { questions } = await get('/questions');const minutes = Math.round(today.reduce((s, c) => s + c.billedSeconds, 0) / 60);const booked = today.filter((c) => c.outcome === 'booked').length;console.log([ `${today.length} calls, ${minutes} minutes, ${booked} booked.`, ...messages.filter((m) => Date.parse(m.at) >= since).map((m) => `URGENT: ${m.callerName ?? 'No name'} — ${m.body}`), ...questions.slice(0, 3).map((q) => `Asked ${q.timesAsked}×, not answered: ${q.question}`),].join('\n'));This is four requests a day. The limit is 600 an hour per key, so even a script that runs every few minutes has room to spare.