Relaunch special: first 3 customers get 15% off. Let's talk

GTM Engineering term, automation and APIs

Serverless function

A serverless function is a small piece of code that runs in the cloud only when triggered, such as by a webhook or schedule, with the provider handling servers, scaling and uptime.

Also called: cloud function, lambda function, edge function, FaaS

Serverless function sits under every stage: it's part of the data and systems the whole funnel runs on, near related terms like Webhook, API and Cron job (the blue squares).

A serverless function is a small piece of code that runs in the cloud only when something triggers it, such as an incoming webhook, an API call or a schedule. The provider handles servers, scaling and uptime, and you pay roughly per run. For GTM teams, functions are the glue between tools when no-code automation runs out of road.

How it works

You write a function, usually in JavaScript, TypeScript or Python, and deploy it to a platform such as AWS Lambda, Cloudflare Workers or Vercel Functions. The platform gives it a URL or attaches it to a trigger:

  1. HTTP trigger: a webhook from a form tool, CRM or billing system calls the function's URL.
  2. Schedule: the platform runs it on a timer, like a managed cron job.
  3. Event or queue: a message on a queue or a file landing in storage starts it.

The function receives the payload, runs its logic (call an enrichment API, score a lead, write to the CRM) and returns. It spins down when idle, which is why it is cheap for spiky GTM workloads like form fills and signal alerts.

Because triggers can fire twice and downstream APIs fail, production functions need idempotency, so a repeat run does not create duplicates, and retry logic with backoff for rate limits.

Example

Say a demo form fires a webhook on every submission. A serverless function:

  1. Validates the payload and drops obvious spam.
  2. Calls an enrichment API for company size and industry.
  3. Scores fit against simple rules and decides the route.
  4. Upserts the contact and account in the CRM, keyed on email, so retries never duplicate.
  5. Posts a Slack alert to the right rep for high-fit leads.

The cost math: assume 3,000 form fills a month, each run taking about one second. Most platforms price that in cents or bundle it in a free tier, while an equivalent multi-step no-code workflow might use five tasks per run, or 15,000 tasks a month. The bigger win is control: the function logs every step and retries exactly the call that failed.

Serverless function vs no-code automation

Tools like n8n and Zapier are faster to build and easier for non-engineers to edit. Serverless functions are cheaper at volume, version-controlled, testable and flexible enough for custom logic. Our rule of thumb: prototype in no-code, then move a workflow into a function once it is business-critical, high volume or needs logic you are fighting the tool to express. Many stacks use both, with a no-code tool calling a function for the hard step.

Common mistakes

  • Hardcoding API keys in the code instead of using environment variables or a secrets store.
  • Skipping idempotency, so a retried webhook creates two CRM records.
  • Trying to process a 50,000-row list in one run and hitting the time limit.
  • Swallowing errors silently, so failures surface weeks later as missing leads.
  • Deploying straight to production with no staging copy or logs.

FAQ

What are examples of serverless platforms?

Common options include AWS Lambda, Google Cloud Functions, Azure Functions, Cloudflare Workers, Vercel Functions and Netlify Functions. They differ in runtime limits, pricing and where the code runs, but the model is the same: you deploy code, the platform runs it on demand.

When should a GTM team use a serverless function instead of Zapier or n8n?

Use a function when a workflow needs custom logic, high volume, low cost per run or tight control over errors and retries. Use a no-code tool when the flow is simple, changes often and needs to be edited by non-engineers.

What are the limits of serverless functions?

Functions have execution time limits, memory caps and possible cold start delays, and the exact limits vary by platform. Long-running jobs such as enriching a huge list in one go usually need to be split into batches or moved to a queue or worker.

See all automation and APIs terms ↳

Used in these articles