Search... Ctrl + K

Create Quick Event (gcal)
One script reply has been approved by the moderators Verified

Created by rossmccrann 128 days ago Used 28 times 1 Point

No comments yet

Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.23.0/mod.ts";

export async function main(
  gcal_auth: wmill.Resource<"gcal">,
  calendarId: string,
  eventText: string,
) {
  const sendUpdates = "all";

  const QUICK_EVENT_URL =
    `https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events/quickAdd/?text=${eventText}&sendUpdates=${sendUpdates}`;

  const token = gcal_auth["token"];

  const response = await fetch(QUICK_EVENT_URL, {
    method: "POST",
    headers: {
      Authorization: "Bearer " + token,
      "Content-Type": "application/json",
    },
  });

  const result = await response.json();

  return result;
}

Submitted by rossmccrann 128 days ago

Edited 128 days ago

No comments yet