Wahlu API
Recipes

Bulk-Create Posts from a Content Calendar

Loop through a spreadsheet or JSON array to create posts programmatically.

If you have a list of content items in a spreadsheet or JSON file, you can create them all programmatically.

JavaScript
const contentCalendar = [
  {
    name: "Monday Motivation",
    instagram: "Start the week strong! What's your #1 goal this week? #mondaymotivation",
    linkedin: "Here's what our team is focused on this week and how we're tackling it.",
  },
  {
    name: "Feature Spotlight",
    instagram: "Did you know you can schedule posts across 5 platforms? #socialmedia #wahlu",
    linkedin: "A deep dive into our scheduling feature and how it saves marketing teams hours per week.",
  },
];

for (const item of contentCalendar) {
  const res = 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: item.name,
        instagram_settings: item.instagram
          ? { description: item.instagram, media_ids: [], post_type: "REEL" }
          : null,
        linkedin_settings: item.linkedin
          ? { description: item.linkedin, media_ids: [], post_type: "LI_TEXT" }
          : null,
      }),
    }
  );

  const { data: contentItem } = await res.json();
  console.log(`Created: ${contentItem.name} (${contentItem.id})`);
}