Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 36 ยท Automation Concepts

Events, Triggers and Actions: The Automation Mental Model

Understand event-driven automation: events, triggers, actions, state and idempotency. Learn the mental model behind every Zap with diagrams and a runnable event-loop stand-in.

Tools come and go, but the ideas behind automation stay the same. Once you understand events, triggers, actions and state, you can build the same workflow in Zapier, Make, n8n or plain code. This lesson gives you that model.

Zapier is not available on this site. The Python blocks are labelled stand-ins: small programs that model the concepts so you can run and change them.

Events: things that happen

An event is a fact about something that happened, at a moment in time: "a form was submitted", "an invoice was paid", "a file appeared in a folder", "it is now 9 a.m. on Monday". Events carry data (who, what, how much) and usually a timestamp and an identifier.

Two families of events matter in automation:

  • App events: something changed in a connected service.
  • Time events: a schedule fires, such as every weekday at 8:00.

Triggers: events that start a workflow

A trigger is the event you chose to react to. Not every event is a trigger: you pick one. "New row in a sheet" is a trigger; a row being edited or deleted are other events you would need a different trigger for. A Zap has exactly one trigger.

Actions: what the workflow does

An action changes something in the world: create, update, delete, send, or look something up. Actions come in a few flavors:

Kind Example Changes data?
Create Add a row, send an email Yes
Update Change a deal stage Yes
Search / find Look up a customer by email No
Utility Format a date, filter, wait Usually no

Searching and utility steps are not glamorous, but they make automations robust. See actions, searches and find-or-create.

State: what the system remembers

Automation platforms remember some state: which items they have already seen, the history of runs, and your saved connections. Other state lives in the apps themselves (the row exists or it does not). Thinking about state helps you answer questions like "what happens if the Zap runs twice?"

Idempotency: safe repeats

An operation is idempotent if doing it twice has the same effect as doing it once. "Set status to paid" is idempotent. "Add 10 to the balance" is not. Automations will sometimes run twice: a retry after a timeout, a replay you start by hand, or a duplicated event. Build actions that tolerate repeats by using find-or-create, upserts, or checks on unique identifiers.

flowchart LR
  E["Event happens"] --> T["Trigger detects it"]
  T --> S{"Seen before?"}
  S -->|"yes"| X["Ignore"]
  S -->|"no"| A["Run actions"]
  A --> M["Remember it"]

Triggers remember what they have already processed, which prevents most duplicate runs.

Linear flows and control flow

The simplest Zap is a straight line. Real work needs decisions and loops: conditions (only continue if...), branches (if A do this, else that) and iteration (do this for each line item). Zapier calls these filters, paths and looping; later chapters cover them (filters, paths).

A tiny event engine

The stand-in below is an event loop: it receives events, a "trigger" decides which are interesting, remembers IDs it has already seen, and runs actions. Run it, then change the events.

Python Stand-in: a tiny event engine

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Three different outcomes appear: ignored because of type, ignored because of duplicate ID, and processed. Real triggers do the same bookkeeping.

Making an action idempotent

Imagine the same event is replayed. A naive "create" would add a second record. An idempotent version looks for an existing record first.

Python Stand-in: create versus find-or-create

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Synchronous and asynchronous work

Some steps finish in milliseconds. Others wait: for a person to approve, for a delay, or for an external system to call back. Platforms handle waiting by pausing the run and resuming later. This is why a Zap can sit "waiting" without consuming resources, and why delays are a normal step type. Long-running work is often split into two Zaps: one that starts the job and another triggered when it finishes.

Failure is normal

Networks time out, passwords expire, apps return errors. A good design assumes failure: it uses retries for temporary problems, alerts for permanent ones, and safe repeats. Zap history, errors and replay shows the tools you get.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is an event?

    Events record that something happened, with data such as ids, amounts and timestamps.
  2. 2. Which operation is idempotent?

    Setting a value to the same thing twice leaves the same result; the others change with each repeat.
  3. 3. How many triggers does a Zap have?

    A Zap starts from a single trigger.
  4. 4. Why use find-or-create instead of create?

    Looking up first makes the action safe to repeat.

Summary

  • Events are facts; a trigger is the event you choose to start a workflow.
  • Actions create, update, search or perform utility work.
  • Platforms remember what they have seen, but your actions must also tolerate repeats.
  • Idempotent design (find-or-create, upsert) prevents duplicates.
  • Expect failure; design for retries and alerts.

Next: Data Flow, Fields and Mapping