Back to product
Product · Power Functions

Run your own code in the middle of every import

Most rules you configure in the interface. Some you compute. Power Functions let you plug your own logic into the transformation, so an import checks and enriches data against your live systems, not just static rules.

import { createHmac } from 'crypto'

// WeTransform triggers this when a transformation uses your Power Function
app.post('/wetransform/check-customer', async (req, res) => {
  verifySignature(req)              // HMAC SHA256, X-Signature header
  res.status(202).send()           // acknowledge now, process async

  const { endpoints } = req.body
  const { payload } = await getJSON(`${endpoints.fetch}?page=1`)

  const outcomes = await Promise.all(
    payload.rows.map(async ({ row, arguments: args }) => {
      const id = args.find(a => a.name === 'customer_id').value
      const known = await db.customers.exists(id)   // your database, your rule
      return { row, outcome: known ? 'valid' : 'unknown customer' }
    })
  )

  await postJSON(endpoints.populate, { outcomes })
})
Your logic, your server

Custom logic that runs on your infrastructure, controlled by WeTransform

A Power Function is a function you write and host. WeTransform calls it during a transformation, passes the rows, and waits for your result. The code runs on your server, so it can reach the things a vendor never should: your database, your internal services, your private APIs.

Power Function code running on your server
The flow

Trigger, fetch, compute, populate

Power Functions are asynchronous, so they hold up nothing. WeTransform sends a trigger to your callback URL. Your server answers 202 right away, pulls the rows to process, up to 1000 per page, runs your logic, and posts the outcomes back. The transformation resumes on its own. It handles large datasets, with execution timeouts up to 60 minutes. Prefer not to write the boilerplate? The docs include a code generator: describe what you need, pick any language, get a working integration grounded in the real endpoints.

Trigger, fetch, compute, populate — Power Function flow
What you build with it

From a simple lookup to real-time enrichment

The most common case is a lookup: check that a customer ID already exists in your database before the row is accepted. From there, teams go further:

  • Verify a VAT number, a SIRET, or a license plate against an official source
  • Enrich an address or a company record from an internal service
  • Sync stock levels in real time before an import commits
  • Call an AI model to return specific information mid-import
Power Function as a rule in the Rule Editor
Configuration is not enough

Some rules can't be configured. They have to be computed.

Every B2B SaaS drowns in format multiplication, the same data arriving a different way from every client. Mapping and validation fix the shape of that data. They cannot tell you whether a customer is real, whether a SKU is in stock, or whether a reference matches your records. Those answers live in your systems. Power Functions bring your logic into the import, without moving your data out of your control.

Static rules versus live call to your systems
Configured, then monitored

Set up once, watched on every run

You create the function in the Integrations section, set the callback URL and an HMAC secret, and pick your timeout and cache duration. It then appears in the Rule Editor, ready to map to your attributes. During a transformation, affected columns show a pending status, and you track progress in real time on the Finalize screen.

Import grid showing Power Function result inline
Security

Your data stays where it belongs

Power Functions run on your server, so a customer lookup never leaves your systems and WeTransform never touches your database. Every trigger is signed with HMAC SHA256, verified with your secret. EU data residency by default.

Learn about security
FAQ

Common questions

Any. It is plain HTTP with an HMAC signature, so it works from Node.js, Python, PHP, Java, Rust, or anything that serves an endpoint.

No. Your code runs on your server. WeTransform sends the rows and receives your result, nothing more.

Rows are fetched up to 1000 per page, execution runs asynchronously, and timeouts go up to 60 minutes, so large imports are fine.

In the Integrations section of the app. Once created, it shows up in the Rule Editor like any other rule.

Get started

Bring your own logic into every import

Stay in the loop

Every two weeks, what we learn building WeTransform: product, market, method.