Skip to content

Instantly share code, notes, and snippets.

function forwardLabeledEmails() {
const labelName = "";
const workerEndpoint = "";
const authToken = "";
const recipientEmail = ""; // Replace with your email address
// Get the date 24 hours ago
const now = new Date();
const twentyFourHoursAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
@TownLake
TownLake / multi-label-summary.js
Created January 27, 2025 15:33
multi-label-summary
function forwardLabeledEmails() {
const labels = ["label1", "label2", "label3"]; // Multiple labels
const workerEndpoint = "";
const authToken = "";
const recipientEmail = ""; // Replace with your email address
// Get the date 24 hours ago
const now = new Date();
const twentyFourHoursAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
export default {
async scheduled(event, env) {
const now = new Date();
const since = new Date(now.getTime() - 24 * 60 * 60 * 1000);
const url = new URL("https://api.ouraring.com/v2/usercollection/heartrate");
url.searchParams.set("start_datetime", since.toISOString());
url.searchParams.set("end_datetime", now.toISOString());
const resp = await fetch(url, {
headers: {