← Discord + Spotify integrations

Get a Playlist's Items with Spotify APIon New Message from Discord API

Pipedream makes it easy to connect APIs for Spotify, Discord and 800+ other apps remarkably fast.

Trigger workflow on
New Message from the Discord API
Next, do this
Get a Playlist's Items with the Spotify API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

This integration creates a workflow with a Discord trigger and Spotify action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the New Message trigger
    1. Connect your Discord account
    2. Configure Channels
    3. Configure discordApphook
    4. Configure Ignore myself
  3. Configure the Get a Playlist's Items action
    1. Connect your Spotify account
    2. Select a Playlist ID
    3. Optional- Configure Fields
    4. Optional- Configure Limit
    5. Optional- Configure Offset
    6. Optional- Select one or more Additional Types
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, open source components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Trigger

Description:Emit an event for each message posted to one or more channels in a Discord server
Version:0.0.2
Key:discord-new-message

Trigger Code

const discord = require("../../discord-v2.app.js")

module.exports = {
  key: "discord-new-message",
  name: 'New Message',
  description: "Emit an event for each message posted to one or more channels in a Discord server",
  version: '0.0.2',
  dedupe: "unique",
  props: {
    discord,
    channels: {
      type: "$.discord.channel[]",
      appProp: "discord",
      label: "Channels",
      description: "Select the channel(s) you'd like to be notified for",
    },
    discordApphook: {
      type: "$.interface.apphook",
      appProp: "discord",
      async eventNames() {
        return this.channels || []
      },
    },
    ignoreMyself: {
      type: "boolean",
      label: "Ignore myself",
      description: "Ignore messages from me",
      default: true,
    },
  },
  async run(event) {
    if (event.guildID != this.discord.$auth.guild_id) {
      return
    }
    if (this.ignoreMyself && event.authorID == this.discord.$auth.oauth_uid) {
      return
    }
    this.$emit(event, { id: event.id })
  },
}

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
DiscorddiscordappThis component uses the Discord app.
Channelschannels$.discord.channel[]

Select the channel(s) you'd like to be notified for

discordApphook$.interface.apphook
Ignore myselfignoreMyselfboolean

Ignore messages from me

Trigger Authentication

Discord uses OAuth authentication. When you connect your Discord account, Pipedream will open a popup window where you can sign into Discord and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Discord API.

Pipedream requests the following authorization scopes when you connect your account:

botemailidentifyguilds

About Discord

Use this app to create a Discord source that emits messages from your guild to a Pipedream workflow.

Action

Description:Get full details of the items of a playlist owned by a Spotify user. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks).
Version:0.0.3
Key:spotify-get-playlist-items

Action Code

import { axios } from "@pipedream/platform";
import get from "lodash/get.js";
import spotify from "../../spotify.app.mjs";

export default {
  name: "Get a Playlist's Items",
  description: "Get full details of the items of a playlist owned by a Spotify user. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks).",
  key: "spotify-get-playlist-items",
  version: "0.0.3",
  type: "action",
  props: {
    spotify,
    playlistId: {
      propDefinition: [
        spotify,
        "playlistId",
      ],
    },
    fields: {
      type: "string",
      label: "Fields",
      description: "Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned. For example, to get just the total number of items and the request limit: `total,limit`. [See the docs](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-playlists-tracks) for more information.",
      optional: true,
    },
    limit: {
      propDefinition: [
        spotify,
        "limit",
      ],
    },
    offset: {
      propDefinition: [
        spotify,
        "offset",
      ],
    },
    additionalTypes: {
      type: "string[]",
      label: "Additional Types",
      description: "A comma-separated list of item types that your client supports besides the default `track` type. Valid types are: `track` and `episode`. **Note**: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future. In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the `type` field of each object.",
      optional: true,
      options: [
        "Track",
        "Episode",
      ],
    },
  },
  async run({ $ }) {
    const {
      playlistId,
      market,
      fields,
      limit,
      offset,
      additionalTypes,
    } = this;

    const res = await axios($, this.spotify._getAxiosParams({
      method: "GET",
      path: `/playlists/${get(playlistId, "value", playlistId)}/tracks`,
      params: {
        fields,
        market,
        limit,
        offset,
        additional_types: additionalTypes && additionalTypes.join(",").toLowerCase(),
      },
    }));

    $.export("$summary", `Successfully fetched details for "${get(playlistId, "label", playlistId)}"`);

    return get(res, "items", []);
  },
};

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

LabelPropTypeDescription
SpotifyspotifyappThis component uses the Spotify app.
Playlist IDplaylistIdstringSelect a value from the drop down menu.
Fieldsfieldsstring

Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are returned. For example, to get just the total number of items and the request limit: total,limit. See the docs for more information.

Limitlimitinteger

The maximum number of items to return. The default is 100.

Offsetoffsetinteger

The index of the first item to return. Default: 0 (the first object). Use with limit to get the next set of items.

Additional TypesadditionalTypesstring[]Select a value from the drop down menu:TrackEpisode

Action Authentication

Spotify uses OAuth authentication. When you connect your Spotify account, Pipedream will open a popup window where you can sign into Spotify and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Spotify API.

Pipedream requests the following authorization scopes when you connect your account:

playlist-read-collaborativeplaylist-modify-privateplaylist-modify-publicplaylist-read-privateuser-modify-playback-stateuser-read-currently-playinguser-read-playback-stateuser-read-privateuser-read-emailuser-library-modifyuser-library-readuser-follow-modifyuser-follow-readuser-read-recently-playeduser-top-readstreamingapp-remote-controlugc-image-uploaduser-read-playback-position

About Spotify

Music streaming

More Ways to Connect Spotify + Discord