Skip to main content

Pipedream Integration Guide

~8 min

Developer-first automation with code steps

Why Pipedream?

Pipedream combines visual workflows with real code. Perfect for developers who want:

Node.js & Python
Full code control
npm packages
Use any library
Free tier
10,000 invocations/mo

Prerequisites

  • StemSplit account with API key
  • Pipedream account (free)
  • Basic JavaScript or Python knowledge
1

Store Your API Key

  1. Get your API key from StemSplit Settings
  2. In Pipedream, go to Settings → Environment Variables
  3. Add: STEMSPLIT_API_KEY = sk_live_xxx
2

Create Workflow with Trigger

Create a new workflow and choose your trigger:

  • HTTP Webhook - Receive POST requests with audio URLs
  • Schedule - Process files on a timer
  • Google Drive - Trigger on new files
  • Email - Process audio attachments
3

Add Code Step: Create Job

Add a Node.js code step:

Create StemSplit Job
export default defineComponent({
  async run({ steps, $ }) {
    const response = await fetch("https://stemsplit.io/api/v1/jobs", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${process.env.STEMSPLIT_API_KEY}`,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        sourceUrl: steps.trigger.event.audioUrl, // From your trigger
        outputType: "BOTH",
        quality: "BEST",
        outputFormat: "MP3"
      })
    });
    
    const job = await response.json();
    
    if (!response.ok) {
      throw new Error(`API Error: ${job.error?.message || "Unknown error"}`);
    }
    
    return job;
  }
});
4

Add Code Step: Poll for Results

Add another Node.js step to wait for completion:

Poll Job Status
export default defineComponent({
  async run({ steps, $ }) {
    const jobId = steps.create_job.$return_value.id;
    const maxAttempts = 60; // 5 minutes max
    
    for (let i = 0; i < maxAttempts; i++) {
      const response = await fetch(
        `https://stemsplit.io/api/v1/jobs/${jobId}`,
        {
          headers: {
            "Authorization": `Bearer ${process.env.STEMSPLIT_API_KEY}`
          }
        }
      );
      
      const job = await response.json();
      
      if (job.status === "COMPLETED") {
        return job; // Contains download URLs in job.outputs
      }
      
      if (job.status === "FAILED") {
        throw new Error(`Job failed: ${job.errorMessage}`);
      }
      
      // Wait 5 seconds before next poll
      await new Promise(r => setTimeout(r, 5000));
    }
    
    throw new Error("Job timed out");
  }
});
5

Process the Results

Access the download URLs from the previous step:

Access Download URLs
// In your next step:
const job = steps.poll_job.$return_value;

// Download URLs (valid for 1 hour)
const vocalsUrl = job.outputs.vocals.url;
const instrumentalUrl = job.outputs.instrumental.url;

// You can now:
// - Download files with fetch()
// - Send to cloud storage
// - Email to user
// - Post to Slack/Discord

Use Pipedream's built-in actions for Google Drive, S3, Slack, etc. to save or share the files.

Alternative: Use Webhooks

Instead of polling, create a separate workflow triggered by StemSplit webhooks:

  1. Create a new Pipedream workflow with HTTP Webhook trigger
  2. Copy the webhook URL
  3. Register it in StemSplit Settings → Webhooks
  4. Your workflow receives job.completed events automatically

Pro Tips

  • • Use $.flow.exit() to end workflow early on errors
  • • Install npm packages directly in code steps: import axios from "axios"
  • • Use Pipedream's data stores for tracking job status across runs
  • • Python steps work too - same logic, different syntax