Telegram bot TO show SPOTIFY recently played
@memeyankm
code:
data:privatelast updated:4 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
Cron Scheduler
Deploy to configure a custom schedule
This workflow runs on Pipedream's servers and is triggered on a custom schedule.
steps.
telegram_bot_api
auth
to use OAuth tokens and API keys in code via theauths object
(auths.telegram_bot_api)
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
return await require("@pipedreamhq/platform").axios(this, {
  url: `https://api.telegram.org/bot${auths.telegram_bot_api.token}/getMe`,
})
steps.
get_current_user_recently_played_tracks
See https://developer.spotify.com/documentation/web-api/reference/player/get-recently-played/
auth
(auths.spotify)
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
}
12
// See https://developer.spotify.com/documentation/web-api/reference/player/get-recently-played/
return (await require("@pipedreamhq/platform").axios(this, {
  url: `https://api.spotify.com/v1/me/player/recently-played`,
  headers: {
    Authorization: `Bearer ${auths.spotify.oauth_access_token}`,
  },
  params: {
    limit: 50,  // Even with pagination, this endpoint only returns the 50 most recent tracks, so we grab them all
  }
})).items