Recipes
Check Publication History
Verify published posts and surface any failures.
After posts are published, check the publication history to verify everything went through or identify failures.
JavaScript
// Get recent publications
const pubsRes = await fetch(
`https://api.wahlu.com/v1/brands/${brandId}/publications?limit=20`,
{ headers: { Authorization: "Bearer wahlu_live_your_api_key_here" } }
);
const { data: publications } = await pubsRes.json();
// Check for failures
const failures = publications.filter(p => p.status === "failed");
if (failures.length > 0) {
console.log("Failed publications:");
for (const f of failures) {
console.log(` ${f.post_name} on ${f.platform}: ${f.failure_reason}`);
}
} else {
console.log(`All ${publications.length} recent publications succeeded.`);
}