GetAlbumPhotos
@raymondcamden
code:
data:privatelast updated:2 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
favicon_end
auth
to use OAuth tokens and API keys in code via theauths object
(auths.google_photos)
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, auths) => {
1
2
}
3
if(steps.trigger.event.url.indexOf('favicon.ico') > 0) $end("favicon");
steps.
get_album
auth
to use OAuth tokens and API keys in code via theauths object
(auths.google_photos)
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
}
19

if(!steps.trigger.event.query.album) $end("Missing album name in query string.");

let result = await require("@pipedreamhq/platform").axios(this, {
  url: 'https://photoslibrary.googleapis.com/v1/albums',
  headers: {
    Authorization: `Bearer ${auths.google_photos.oauth_access_token}`,
  },
});

let favorite = result.albums.find(a => {
  return a.title.toLowerCase() === steps.trigger.event.query.album.toLocaleLowerCase();
});

if(!favorite) $end("Invalid album name passed.");

return favorite.id;
steps.
get_photos
auth
to use OAuth tokens and API keys in code via theauths object
(auths.google_photos)
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
}
15
let result = await require("@pipedreamhq/platform").axios(this, {
  url: 'https://photoslibrary.googleapis.com/v1/mediaItems:search',
  headers: {
    Authorization: `Bearer ${auths.google_photos.oauth_access_token}`,
  },
  method:'post',
  data: {
    albumId:steps.get_album.$return_value,
    pageSize:100
  }
});

return result.mediaItems.map(m => m.baseUrl);
steps.
return_photos
auth
to use OAuth tokens and API keys in code via theauths object
(auths.google_photos)
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, auths) => {
1
2
3
4
5
6
7
8
9
10
}
11


await $respond({
  status:200,
  headers: {
    'Content-Type':'application/json'
  },
  body:steps.get_photos.$return_value
})