Recipes
Create and Schedule a Post
Fetch your brand, create a multi-platform post, and schedule it for publishing.
The most common workflow: create a content item with platform-specific content, then schedule a publish run. This involves three API calls.
Step 1: Get your brand and integrations
First, fetch your brands to get the brand_id, then list integrations to find the integration_id for each platform you want to publish to.
JavaScript
// Get brands
const brandsRes = await fetch("https://api.wahlu.com/v1/brands", {
headers: { Authorization: "Bearer wahlu_live_your_api_key_here" },
});
const { data: brands } = await brandsRes.json();
const brandId = brands[0].id;
// Get integrations for this brand
const integrationsRes = await fetch(
`https://api.wahlu.com/v1/brands/${brandId}/integrations`,
{ headers: { Authorization: "Bearer wahlu_live_your_api_key_here" } }
);
const { data: integrations } = await integrationsRes.json();
// Find the Instagram and LinkedIn integration IDs
const instagram = integrations.find(i => i.platform === "instagram");
const linkedin = integrations.find(i => i.platform === "linkedin");
// Optional: find one completed image for Instagram
const mediaRes = await fetch(
`https://api.wahlu.com/v1/brands/${brandId}/media?limit=50`,
{ headers: { Authorization: "Bearer wahlu_live_your_api_key_here" } }
);
const { data: media } = await mediaRes.json();
const completedImage = media.find((m) => m.status === "completed" && m.content_type.startsWith("image"));Step 2: Create the content item
Create a content item with content for each platform. Each platform has its own settings object — you only need to include the platforms you want to publish to. If you need to upload media first, use the Media API flow (upload-url → PUT → PATCH status=ready_for_processing).
JavaScript
const contentItemRes = await fetch(
`https://api.wahlu.com/v1/brands/${brandId}/content-items`,
{
method: "POST",
headers: {
Authorization: "Bearer wahlu_live_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Weekly Product Update",
instagram_settings: {
description: "Big news! Our latest feature is live. Check the link in bio for details. #productupdate #saas",
media_ids: completedImage ? [completedImage.id] : [],
post_type: "REEL",
},
linkedin_settings: {
description: "Excited to announce our latest feature release. Here's what's new and why it matters for your workflow.",
post_type: "LI_TEXT",
},
}),
}
);
const { data: contentItem } = await contentItemRes.json();Step 3: Create the publish run
Schedule publishing by providing the content item ID, a future date/time, and which integrations to publish to.
JavaScript
// Schedule for tomorrow at 9am UTC
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(9, 0, 0, 0);
const integrationIds = [linkedin?.id, completedImage ? instagram?.id : null].filter(Boolean);
const scheduleRes = await fetch(
`https://api.wahlu.com/v1/brands/${brandId}/publish-runs`,
{
method: "POST",
headers: {
Authorization: "Bearer wahlu_live_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
content_item_id: contentItem.id,
scheduled_at: tomorrow.toISOString(),
integration_ids: integrationIds,
}),
}
);
const { data: publishRun } = await scheduleRes.json();
console.log(`Publish run scheduled for ${publishRun.scheduled_at}`);