Event rules: react when something happens
Route events such as user.created to a queue, function, webhook or email, and test rules with a sample event.
Events let you separate "something happened" from "what should happen next". A rule matches an event name and sends it to a target. You can add a new side effect, such as a welcome email or a sync to another system, without touching your sign-up code.
Open Events & Webhooks
In the sidebar, under Platform Services, choose Events & Webhooks. The page, Event Bus & Reactive Triggers, lists your Event Routing Rules and the Recent Event History.
Which events you can use
Your project's authentication emits these events, and any rule matching them runs automatically:
user.createduser.loginuser.login_faileduser.password_resetsession.revoked
Actions can also emit events through an event effect. See Actions. Your own server code does not emit custom event names directly; events come from authentication, from actions, and from the Emit a Test Event form.
Create a rule
- Choose + Create Event Rule.
- Enter an Event Pattern, such as
user.created, or a pattern with a star, such asuser.*or*for everything. - Choose a Target Type:
- Queue (Enqueue message): enter the queue name.
- Function (Execute Cloud Function): pick a deployed function.
- Webhook (HTTP POST): enter the URL and method. The address must be public, because internal or private targets are blocked.
- Mail (Send Email): enter a recipient and subject.
- Add a Description if you like.
- Choose Create Rule.
A rule that is missing its target details is refused, for example "Enter a queue name" or "Enter the webhook URL to call", so a rule never silently does nothing.
Test a rule
Use Emit a Test Event to fire a real event through the bus without waiting for the real trigger. Enter an Event Name such as user.created and a Payload (JSON), then choose Emit Event. The result appears in Recent Event History with the event name, target, status (Success, Failed, or Spend Cap), attempts and time.
Good to know
- Each matching rule runs separately, so one event can trigger a function and a queue message at once.
- The history shows how many attempts each delivery took and whether it succeeded, so you can see why one failed.
- To delete a rule, choose Delete on its row. Events already delivered are not undone.
- For webhooks you receive from other services, see Webhooks: receiving and sending.