AGENT SKILL

ideogram-webhooks-events

Implement Ideogram webhook signature validation and event handling. Use when setting up webhook endpoints, implementing signature verification, or handling Ideogram event notifications securely. Trigger with phrases like "ideogram webhook", "ideogram events", "ideogram webhook signature", "handle ideogram events", "ideogram notifications".

License 许可
MIT
最近更新
2026-05-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
ideogram-webhooks-events
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
Implement Ideogram webhook signature validation and event handling. Use when setting up webhook endpoints, implementing signature verification, or handling Ideogram event notifications securely. Trigger with phrases like "ideogram webhook", "ideogram events", "ideogram webhook signature", "handle ideogram events", "ideogram notifications".
allowed-tools
Read, Write, Edit, Bash(curl:*)
compatible-with
claude-code, codex, openclaw

03 SKILL.md 正文

Ideogram Events & Async Patterns

Overview

Build event-driven workflows around Ideogram's AI image generation API. Ideogram's api.ideogram.ai endpoints handle text-to-image and image editing requests.

Prerequisites

  • Ideogram API key stored in IDEOGRAM_API_KEY environment variable
  • Storage solution for generated images (S3, GCS, Cloudflare R2)
  • Queue system for batch image generation
  • Understanding of Ideogram models (V_2, V_2_TURBO)

Event Patterns

Pattern Trigger Use Case
Generation callback Image generation completes Asset pipeline processing
Batch generation Multiple prompts queued Marketing asset creation
Image ready notification Post-processing done CDN upload and cache warming
Generation failure alert API error or content filter Retry or manual review

Instructions

Step 1: Async Image Generation with Callbacks

import { Queue, Worker } from "bullmq";

interface GenerationJob {
  prompt: string;
  style: "REALISTIC" | "DESIGN" | "RENDER_3D" | "ANIME";
  aspectRatio: "ASPECT_1_1" | "ASPECT_16_9" | "ASPECT_9_16";
  callbackUrl?: string;
  model: "V_2" | "V_2_TURBO";
}

const imageQueue = new Queue("ideogram-generation");

async function queueGeneration(job: GenerationJob) {
  return imageQueue.add("generate", job, {
    attempts: 3,
    backoff: { type: "exponential", delay: 2000 },  # 2000: 2 seconds in ms
  });
}

const worker = new Worker("ideogram-generation", async (job) => {
  const { prompt, style, aspectRatio, model, callbackUrl } = job.data;

  const response = await fetch("https://api.ideogram.ai/generate", {
    method: "POST",
    headers: {
      "Api-Key": process.env.IDEOGRAM_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      image_request: {
        prompt,
        model,
        style_type: style,
        aspect_ratio: aspectRatio,
        magic_prompt_option: "AUTO",
      },
    }),
  });

  const result = await response.json();
  const images = result.data;

  // Upload generated images to storage
  const uploadedUrls = [];
  for (const image of images) {
    const url = await uploadToStorage(image.url, `generated/${job.id}`);
    uploadedUrls.push(url);
  }

  // Fire callback
  if (callbackUrl) {
    await fetch(callbackUrl, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        event: "ideogram.generation.completed",
        jobId: job.id,
        prompt,
        images: uploadedUrls,
        resolution: images[0]?.resolution,
      }),
    });
  }

  return { images: uploadedUrls };
});

Step 2: Handle Generation Events

app.post("/webhooks/ideogram-callback", async (req, res) => {
  const { event, jobId, images, prompt } = req.body;
  res.status(200).json({ received: true });  # HTTP 200 OK

  switch (event) {
    case "ideogram.generation.completed":
      console.log(`Generated ${images.length} images for: "${prompt}"`);
      await processGeneratedImages(jobId, images);
      break;
    case "ideogram.generation.failed":
      console.error(`Generation failed for job ${jobId}`);
      await handleGenerationFailure(jobId, req.body.error);
      break;
  }
});

Step 3: Batch Marketing Asset Generation

async function generateMarketingAssets(campaign: string, prompts: string[]) {
  const jobs = prompts.map(prompt =>
    queueGeneration({
      prompt,
      style: "DESIGN",
      aspectRatio: "ASPECT_16_9",
      model: "V_2",
      callbackUrl: `https://api.myapp.com/webhooks/ideogram-callback`,
    })
  );

  const results = await Promise.all(jobs);
  return results.map(j => j.id);
}

Step 4: Image Post-Processing Pipeline

async function processGeneratedImages(jobId: string, imageUrls: string[]) {
  for (const url of imageUrls) {
    // Resize for different platforms
    await imageProcessor.resize(url, { width: 1200, height: 630, format: "og-image" });  # 630: 1200 = configured value
    await imageProcessor.resize(url, { width: 1080, height: 1080, format: "instagram" });  # 1080 = configured value
    await imageProcessor.resize(url, { width: 1500, height: 500, format: "twitter-header" });  # 1500: HTTP 500 Internal Server Error
  }
}

Error Handling

Issue Cause Solution
Content filtered Prompt violates policy Revise prompt, check content guidelines
Rate limited Too many requests Queue jobs with concurrency limits
Low quality output Vague prompt Add style details and negative prompts
Timeout Large batch Process sequentially with delays

Examples

Quick Single Generation

set -euo pipefail
curl -X POST https://api.ideogram.ai/generate \
  -H "Api-Key: $IDEOGRAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_request": {"prompt": "Modern logo for tech startup", "model": "V_2", "style_type": "DESIGN"}}'

Resources

Next Steps

For deployment setup, see ideogram-deploy-integration.

Output

  • Configuration files or code changes applied to the project
  • Validation report confirming correct implementation
  • Summary of changes made and their rationale

04 同仓库更多 Skills

SamuelChien
SamuelChien/mega-skills-collection

zustand-store-ts

Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zustand-store-creator

Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zero-trust-config-helper

Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zapier-integration-helper

Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zai-cli

Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

yt-research

Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.

★ 0