통합

Pipedream

Pipedream Code step에서 Thunderbit 실행 —— Node.js든 Python이든

Pipedream 은 Zapier 의 개발자 친화 사촌입니다 —— 모든 워크플로가 직접 편집 가능한 진짜 스크립트입니다. 완전 통제가 필요하면 Code step, 노코드라면 HTTP / Webhook 액션을 쓰세요.

Code step (Node.js)

import { defineComponent } from '@pipedream/core';

export default defineComponent({
  props: {
    thunderbit: { type: 'app', app: 'thunderbit' }, // or use an env var
    url:        { type: 'string' },
  },
  async run({ steps, $ }) {
    const res = await fetch(
      'https://openapi.thunderbit.com/openapi/v1/distill',
      {
        method: 'POST',
        headers: {
          Authorization: `Bearer ${process.env.THUNDERBIT_API_KEY}`,
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({ url: this.url, renderMode: 'basic' }),
      },
    );
    const json = await res.json();
    return json.data.markdown;
  },
});

Code step (Python)

import os, httpx

def handler(pd: "pipedream"):
    res = httpx.post(
        "https://openapi.thunderbit.com/openapi/v1/distill",
        headers={"Authorization": f"Bearer {os.environ['THUNDERBIT_API_KEY']}"},
        json={"url": pd.steps["trigger"]["event"]["url"], "renderMode": "basic"},
        timeout=60.0,
    )
    return res.json()["data"]["markdown"]

HTTP source 로 배치 처리

/batch/distill 의 경우, 두 번째 워크플로의 트리거HTTP / Webhook source 를 추가한 다음 Thunderbit 의 callback.url 을 Pipedream 이 알려준 source URL 로 지정하세요. 배치가 끝나면 트리거가 발화하고 —— 다운스트림 step 이 전체 결과 배열을 받게 됩니다.

  • API Key 는 코드가 아니라 Pipedream Env Var(워크스페이스별 또는 워크플로별) 에 저장하세요
  • Pipedream 무료 등급은 step 당 컴퓨트 제한이 있습니다 —— 다운스트림 LLM 호출 전에 Markdown 을 슬림하게 유지하세요

관련 문서