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-03-20
Stars
★ 4
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

micsapp
micsapp/micstec-skills

azure-apim-architecture

Analyzes and explains Azure API Management architecture decisions for enterprise API marketplace implementations using VNet Internal mode, Front Door, hybrid authentication, and multi-environment strategies. Use when discussing APIM component selection, network topology, cost optimization, or comparing alternatives like workspaces vs instances, VNet Internal vs External mode, or Front Door vs Application Gateway.

★ 4
micsapp
micsapp/micstec-skills

apiops-deployment

Guides deployment of Azure API Management infrastructure using Infrastructure as Code (Bicep/Terraform), CI/CD pipelines (GitHub Actions/Azure DevOps), and APIOps workflows. Use when deploying APIM, creating pipelines, or implementing dev→test→prod promotion strategies.

★ 4
micsapp
micsapp/micstec-skills

apim-policy-authoring

Creates production-ready Azure API Management policy XML for authentication (OAuth 2.0, JWT validation, subscription keys), rate limiting, CORS configuration, error handling, and API transformations. Use when implementing API security, access control, or request/response processing logic.

★ 4
micsapp
micsapp/micstec-skills

api-security-review

Reviews Azure API Management configurations for security vulnerabilities, OWASP API Security Top 10 compliance, VNet Internal mode validation, Private Link verification, and Azure Security Benchmark alignment. Use when performing security audits, pre-deployment validation, or compliance reviews.

★ 4
micsapp
micsapp/micstec-skills

jira-cli

Interact with Jira from the command line to create, list, view, edit, and transition issues, manage sprints and epics, and perform common Jira workflows. Use when the user asks about Jira tasks, tickets, issues, sprints, or needs to manage project work items.

★ 4
micsapp
micsapp/micstec-skills

calculator

Performs arbitrary-precision arithmetic calculations including addition, subtraction, multiplication, division, and exponents. Use when the user asks to calculate, compute, or evaluate math expressions, or when precise decimal arithmetic is needed to avoid floating-point errors.

★ 4