FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
stevekrouse
stevekrousepipedream
Public
Like
1
pipedream
Home
Code
2
README.md
S
main.tsx
Branches
1
Pull requests
Remixes
1
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Pipedream helpers

Pipedream offers an Accounts API to handle OAuth for you, automatically, and for free. How to do it is covered in this guide.

The helper functions below can make it easier to work with various Google API. For example, I used them like so to get all my free/busy times for this week from all my google calendars:

Create val
import { pipeDreamGoogle } from "https://esm.town/v/stevekrouse/pipedream"; const accountId = "REPLACE_WITH_YOUR_GCAL_ACCOUNT_ID_FROM_PIPEDREAM"; const calendar = await pipeDreamGoogle("calendar", accountId); // Function to get free/busy information async function getFreeBusyTimes(calendarId: string) { const now = new Date(); const startOfWeek = new Date(now); startOfWeek.setDate(now.getDate() - now.getDay()); const endOfWeek = new Date(startOfWeek); endOfWeek.setDate(startOfWeek.getDate() + 6); const requestBody = { timeMin: startOfWeek.toISOString(), timeMax: endOfWeek.toISOString(), items: [{ id: calendarId }], }; const freeBusyResponse = await calendar.freebusy.query({ requestBody, }); return freeBusyResponse.data.calendars[calendarId].busy; } const calendars = (await calendar.calendarList.list()).data.items; const freeBusy = await Promise.all(calendars.map(calendar => getFreeBusyTimes(calendar.id))); console.log(freeBusy);

In order for this to work you need to follow the instructions in this guide to save your pipedream API key into your Val Town Environment Variables under pipedream, then connect the google account you care about to Pipedream, and copy it's Pipedream "account id" into your val code. Let me know if you need any help by commenting on this val!

Migrated from folder: Archive/pipedream

Code
README.md
S
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.