Skip to content
Integration

Pipedream Integration - Generate Images in Code

Render on-brand images inside a Pipedream workflow with a short Node.js step. Map trigger data to a template's fields and hand the result to later steps.

Pipedream and imejis connected

Pipedream renders imejis designs from a short Node.js code step. Design a template once, mark the layers that change as dynamic fields, then map trigger data into them and pass the result down the workflow.

Pipedream calls the render API directly, like n8n. The difference is that you are writing the request rather than filling in a form, which matters more than it sounds: a code step can loop, retry and branch on the response.

What you can automate

  • Social graphics from any trigger, since a webhook, an email or a CRM event all arrive as plain data.
  • One image per record in a loop, without a separate workflow per row.
  • Receipts, certificates and badges from a payment or a form submission.

The code step

export default defineComponent({
  async run({ steps }) {
    const res = await fetch(
      "https://render.imejis.io/v1/<designId>?delivery=hosted",
      {
        method: "POST",
        headers: {
          "dma-api-key": process.env.IMEJIS_API_KEY,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          "title.text": steps.trigger.event.name,
          "plan.text": steps.trigger.event.plan,
        }),
      }
    )
    return await res.json()
  },
})

Keep the key in an environment variable rather than inline, so it stays out of the workflow's exported JSON.

Ask for a URL, not bytes

In a no-code tool the binary response is convenient: the next step takes the file. In a code step it is the opposite. Raw bytes mean handling a buffer, deciding where to put it, and passing something awkward between steps.

Appending ?delivery=hosted makes the endpoint return JSON instead:

{
  "success": true,
  "delivery": "hosted",
  "url": "https://...",
  "format": "png",
  "file": { "size": 46819 }
}

Return that and every later step gets a plain url string. It is also cheaper in a loop, because a stored URL is fetched rather than re-rendered.

Looping without burning quota

A code step makes it easy to render in a loop, and just as easy to render the same thing repeatedly by accident. Two things worth building in:

  • Render once per unique record, not once per workflow run. Re-running a workflow to debug a later step re-renders everything above it.
  • Store the returned URL on the record. The second run then has nothing to do.

Every render counts as one render, so a loop over 500 rows is 500 renders.

Going further

  • The same request from other languages is in the API reference.
  • Prefer a form to a code step? n8n, Zapier and Make do the same job without the editor.
  • Output formats are PNG, JPEG, WebP and single-page PDF, chosen with ?format=. Render allowances are on the pricing page.

Connect with Pipedream using Zapier

We use cookies to run the site and, depending on your region and your choice here, for analytics and marketing. See our Cookie Policy. You can change this any time from “Cookie settings” in the footer.