---
title: "Automation events and webhooks"
description: "Send custom events from your backend, list the ones you've sent with their payload keys, and get signed webhooks when an automation changes."
url: https://www.unitpost.com/guides/automations-events
section: Guides
updated: 2026-11-29
---
# Automation events and webhooks

## Automation events and webhooks

> Send custom events from your backend, list the ones you've sent with their payload keys, and get signed webhooks when an automation changes.

Your backend tells Unitpost what happened with custom events. Each one can start automations, resume runs waiting for it, and meet a goal.

### Send an event

- Names are your own: lowercase, dot separated, up to 5 parts (`cart.updated`, `order.completed`). No `custom.` prefix.
- Platform prefixes are reserved and refused: `email.`, `domain.`, `contact.`, `segment.`, `topic.`, `campaign.`, `automation.`, `workspace.`, `message.`, `sms.`, `whatsapp.`, `telegram.`, `sender.`, `push.`, `voice.`, `rcs.`, `chat.`.
- Link the event to a contact with `email` or `contact_id`. An `email` that isn't a contact yet becomes one when a live automation that needs a contact starts from the event (subscribed, no topics chosen, like `POST /contacts`, its consent source `event`; it counts against the plan's contacts); `create_contact: false` opts out, and then that journey starts no run for it (`guard_trips.unmatched_subject`). At the plan's contact limit no contact is made and no run starts (`guard_trips.contact_limit`). A journey that only emails a fixed address or calls a webhook (an ops alert) runs with no contact either way.
- Keep secrets out of event data (tokens, one-time codes, passwords, verify or sign-in links): it is kept in the event log and each run's history and goes to every webhook subscribed to the event. Validate warns (`event_data_secret`).
- Pass `idempotency_key` so a retried request emits once.
- The first event with a new name registers it. `GET /v1/events/definitions` lists your names and the payload keys seen with them.
- Sending events needs the events:emit capability. A Sending key created before automations launched doesn't have it (`403 insufficient_scope` says so): create a new Sending key. Webhook endpoints can subscribe to your event names too.

**cURL**

```bash
curl -X POST 'https://www.unitpost.com/api/v1/events' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "cart.updated",
    "email": "sam@acme.com",
    "data": {
      "cart_url": "https://shop.acme.com/cart/123",
      "item_count": 2
    },
    "idempotency_key": "cart-123-v4"
  }'
```

**CLI**

```bash
unitpost events emit \
  --name cart.updated \
  --email sam@acme.com \
  --data '{"cart_url":"https://shop.acme.com/cart/123","item_count":2}' \
  --idempotency-key cart-123-v4
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.events.emit({
  name: "cart.updated",
  email: "sam@acme.com",
  data: {
    cart_url: "https://shop.acme.com/cart/123",
    item_count: 2,
  },
  idempotency_key: "cart-123-v4",
});
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.events.emit({
    "name": "cart.updated",
    "email": "sam@acme.com",
    "data": {
        "cart_url": "https://shop.acme.com/cart/123",
        "item_count": 2,
    },
    "idempotency_key": "cart-123-v4",
})
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.events.emit({
  name: "cart.updated",
  email: "sam@acme.com",
  data: {
    cart_url: "https://shop.acme.com/cart/123",
    item_count: 2,
  },
  idempotency_key: "cart-123-v4",
})
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->events->emit([
    "name" => "cart.updated",
    "email" => "sam@acme.com",
    "data" => [
        "cart_url" => "https://shop.acme.com/cart/123",
        "item_count" => 2,
    ],
    "idempotency_key" => "cart-123-v4",
]);
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::events()->emit([
    "name" => "cart.updated",
    "email" => "sam@acme.com",
    "data" => [
        "cart_url" => "https://shop.acme.com/cart/123",
        "item_count" => 2,
    ],
    "idempotency_key" => "cart-123-v4",
]);
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Events.Emit(ctx, map[string]any{
	"name": "cart.updated",
	"email": "sam@acme.com",
	"data": map[string]any{
		"cart_url": "https://shop.acme.com/cart/123",
		"item_count": 2,
	},
	"idempotency_key": "cart-123-v4",
})
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.events.emit(java.util.Map.of(
    "name", "cart.updated",
    "email", "sam@acme.com",
    "data", java.util.Map.of(
        "cart_url", "https://shop.acme.com/cart/123",
        "item_count", 2
    ),
    "idempotency_key", "cart-123-v4"
));
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.events().emit(serde_json::json!({"name":"cart.updated","email":"sam@acme.com","data":{"cart_url":"https://shop.acme.com/cart/123","item_count":2},"idempotency_key":"cart-123-v4"})).await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Events.Emit(new {
    name = "cart.updated",
    email = "sam@acme.com",
    data = new {
        cart_url = "https://shop.acme.com/cart/123",
        item_count = 2,
    },
    idempotency_key = "cart-123-v4",
});
```

### Limits

- A workspace can use 500 event names. A new name past that is refused (`403 limit_reached`) and names can't be deleted yet: reuse one, or contact support to remove names you no longer send. Keep ids and other changing values in `data`, never in the name.
- A contact an event makes has its email address and nothing else: a template that says "Hi {{first_name}}" fails for them (readiness says `event_contact_no_name`) unless the block gives the name a fallback, used only for a contact without one (`variables: { first_name: { path: "contact.first_name", fallback: "there" } }`), or the name is saved on the contact first.
- Each event is one request against the workspace's API request limit, which sends share (10 a second by default, with no batch call): a request over it is a `429` that recorded nothing, safe to send again after `Retry-After`.

> **A test event is real:** An event starts a run in every live automation listening for it (one live run per person by default), and those can send. Emit one by hand only when that is what you want.

### Events you've sent

`GET /v1/events/definitions` lists each event name your backend has sent, when it was last seen, and the payload keys seen with it (key names and types, never values). Build triggers and `event.data` conditions from it instead of guessing.

**cURL**

```bash
curl -X GET 'https://www.unitpost.com/api/v1/events/definitions' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
```

**CLI**

```bash
unitpost events list-definitions
```

**Node.js**

```ts
import { Unitpost } from "unitpost";

const unitpost = new Unitpost(process.env.UNITPOST_API_KEY);

const { data, error } = await unitpost.events.listDefinitions();
```

**Python**

```python
from unitpost import Unitpost

unitpost = Unitpost()  # reads UNITPOST_API_KEY

result = unitpost.events.list_definitions()
```

**Ruby**

```ruby
require "unitpost"

unitpost = Unitpost::Client.new  # reads UNITPOST_API_KEY

result = unitpost.events.list_definitions()
```

**PHP**

```php
require 'vendor/autoload.php';

use Unitpost\Client;

$unitpost = new Client(); // reads UNITPOST_API_KEY

$result = $unitpost->events->listDefinitions();
```

**Laravel**

```php
use Unitpost\Laravel\Facades\Unitpost;

$result = Unitpost::events()->listDefinitions();
```

**Go**

```go
import (
    "context"
    "github.com/unitpostcom/unitpost-go"
)

client := unitpost.New() // reads UNITPOST_API_KEY
ctx := context.Background()

data, err := client.Events.ListDefinitions(ctx)
```

**Java**

```java
import com.unitpost.Unitpost;

var unitpost = new Unitpost(); // reads UNITPOST_API_KEY

var result = unitpost.events.listDefinitions();
```

**Rust**

```rust
use unitpost::Unitpost;

let unitpost = Unitpost::new(); // reads UNITPOST_API_KEY

let result = unitpost.events().list_definitions().await;
```

**.NET**

```csharp
using Unitpost;

var unitpost = new UnitpostClient(); // reads UNITPOST_API_KEY

var result = await unitpost.Events.ListDefinitions();
```

### Automation webhooks

Subscribe a webhook endpoint (/docs/platform/webhooks) to these automation events, or to `automation.*`: `automation.paused`, `automation.resumed`, `automation.run.failed`. A pause carries its `pause_reason` (see Automation runs and debugging (/guides/automations-runs)). Each delivery is the usual signed envelope; `data` differs by type:

### automation.paused

| Field | Type | What it is |
| --- | --- | --- |
| `automation_id` | string | The automation (`atm_…`). |
| `name` | string | Its name when the event happened. |
| `status` | string | `paused`. |
| `pause_reason` | string | Why it paused: one of the pause reasons (`user`, `dependency_broken`, `billing`, …). New values can be added: treat one you don't know as paused for another reason. |

**Delivery body**

```bash
{
  "type": "automation.paused",
  "source": "platform",
  "created_at": "2026-01-15T09:30:00.000Z",
  "event_id": "f6a1f1f6-6a86-4f8f-9d2e-1c2b3a4d5e6f",
  "workspace_id": "ws_2WworkspaceExmpl1",
  "data": {
    "automation_id": "atm_2WautomationExmpl",
    "name": "Welcome series",
    "status": "paused",
    "pause_reason": "dependency_broken"
  }
}
```

### automation.resumed

| Field | Type | What it is |
| --- | --- | --- |
| `automation_id` | string | The automation (`atm_…`). |
| `name` | string | Its name when the event happened. |
| `status` | string | `active`. |
| `pause_reason` | null | Always `null` on a resume. |

**Delivery body**

```bash
{
  "type": "automation.resumed",
  "source": "platform",
  "created_at": "2026-01-15T09:30:00.000Z",
  "event_id": "f6a1f1f6-6a86-4f8f-9d2e-1c2b3a4d5e6f",
  "workspace_id": "ws_2WworkspaceExmpl1",
  "data": {
    "automation_id": "atm_2WautomationExmpl",
    "name": "Welcome series",
    "status": "active",
    "pause_reason": null
  }
}
```

### automation.run.failed

| Field | Type | What it is |
| --- | --- | --- |
| `automation_id` | string | The automation (`atm_…`). |
| `name` | string | Its name when the event happened. |
| `run_id` | string | The run (`run_…`). Read it with `GET /v1/automations/runs/{id}` for the step and its error, which the webhook never carries. |
| `version` | number | null | The published version the run was on. |
| `contact_id` | string | null | The contact (`con_…`), never an address; `null` for a run with no contact. |
| `failed_block` | object | null | `{ id, kind, title }` of the block it failed at; `null` when it failed outside a block (the step limit, billing, a broken version). |
| `reason` | string | Why: `block_failed`, `max_steps`, `billing_rejected`, `definition_invalid`, `unknown_block`, `other`. |
| `failed_at` | string | When the run failed (ISO 8601, UTC). |

**Delivery body**

```bash
{
  "type": "automation.run.failed",
  "source": "platform",
  "created_at": "2026-01-15T09:30:00.000Z",
  "event_id": "f6a1f1f6-6a86-4f8f-9d2e-1c2b3a4d5e6f",
  "workspace_id": "ws_2WworkspaceExmpl1",
  "data": {
    "automation_id": "atm_2WautomationExmpl",
    "name": "Welcome series",
    "run_id": "run_2WrunExample00001",
    "version": 3,
    "contact_id": "con_2WcontactExmpl01",
    "failed_block": {
      "id": "send_welcome",
      "kind": "action.email.send",
      "title": "Send welcome email"
    },
    "reason": "block_failed",
    "failed_at": "2026-01-15T09:30:00.000Z"
  }
}
```

Webhook endpoints can also subscribe to your own event names, so one event can drive an automation and your other systems.

## Related

- [Automation billing](https://www.unitpost.com/guides/automations-billing): What an automation run costs, how many runs each plan includes, the usage notices, and what happens when the included runs are used up.
- [How it all fits together](https://www.unitpost.com/guides/overview): The contacts → segments → campaigns flow and the rules that keep it safe.
- [Dashboard](https://www.unitpost.com/guides/dashboard): Your account at a glance — sending health, recent activity, and what needs attention.
