Prerequisites
You'll need the following before you start:
- PodClaw API key — free at podclaw.io/signup
- Python 3.9+ with
haystack-ai and requests installed
- A publicly accessible audio file URL (MP3, M4A, or OGG)
pip install haystack-ai requests
Custom PodClaw Component
Haystack's @component decorator turns any Python class into a pipeline node. The component below accepts episode metadata as typed inputs and calls the PodClaw REST API to publish the episode, returning the episode ID and public URL.
python — podclaw_component.py
import requests
from haystack import component
PODCLAW_API_KEY = "pc_your_api_key_here"
BASE_URL = "https://podclaw.io/api"
@component
class PodClawShowCreator:
"""Creates a new podcast show on PodClaw."""
@component.output_types(show_id=str, rss_url=str)
def run(self, title: str, description: str, category: str = "Technology"):
resp = requests.post(
f"{BASE_URL}/shows",
headers={"Authorization": f"Bearer {PODCLAW_API_KEY}"},
json={"title": title, "description": description, "category": category},
timeout=30,
)
resp.raise_for_status()
data = resp.json()
return {"show_id": data["id"], "rss_url": data.get("rss_url", "")}
@component
class PodClawPublisher:
"""Publishes an episode to PodClaw and returns the episode URL."""
@component.output_types(episode_id=str, episode_url=str, success=bool)
def run(self, show_id: str, title: str, audio_url: str, description: str = ""):
resp = requests.post(
f"{BASE_URL}/shows/{show_id}/episodes",
headers={"Authorization": f"Bearer {PODCLAW_API_KEY}"},
json={
"title": title,
"description": description,
"audio_url": audio_url,
"status": "published",
},
timeout=30,
)
resp.raise_for_status()
data = resp.json()
return {
"episode_id": data.get("id", ""),
"episode_url": data.get("url", ""),
"success": True,
}
Wiring it into a Pipeline
Add the component to a Haystack Pipeline and connect it to upstream nodes. Here's a minimal example that publishes directly from a known audio URL:
python — run_pipeline.py
from haystack import Pipeline
from podclaw_component import PodClawPublisher
pipe = Pipeline()
pipe.add_component("publisher", PodClawPublisher())
result = pipe.run({
"publisher": {
"show_id": "show_abc123",
"title": "Weekly AI Digest — Episode 14",
"audio_url": "https://your-storage.com/episode-14.mp3",
"description": "This week: GPT updates, open-source releases, and community news.",
}
})
print("Episode live at:", result["publisher"]["episode_url"])
Tip: To build a full RAG-to-podcast pipeline, chain an InMemoryBM25Retriever → OpenAIGenerator → TTS component → PodClawPublisher. Connect the TTS component's audio_url output to the publisher's audio_url input.
What happens after publish
Once your pipeline calls run(), PodClaw handles everything downstream:
- The episode is appended to your RSS feed immediately — Apple Podcasts and Spotify pick it up within hours
- A permanent, shareable episode page is created at the returned
episode_url
- Download analytics start accumulating from the first play
- Platform indexing confirmations are delivered via optional webhooks