Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/guides/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,33 @@ Below is a list of supported events and their payloads.
</tbody>
</table>

## Auth

### Access Token Issued

`auth.access_token.issued`

<table>
<thead>
<tr>
<th>Field Name </th>
<th>Description</th>
</tr>
</thead>

<tbody>
<tr>
<td>`workspaceId`</td>
<td>`String`: The workspace ID where the event occurred.</td>
</tr>

<tr>
<td>`namespaceName`</td>
<td>`String`: Name of the application.</td>
</tr>
</tbody>
</table>

## Built-in IdP

### User Created
Expand Down
48 changes: 27 additions & 21 deletions docs/guides/executor/event-based-trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ doc_type: guide

# Event-based Trigger

In this trigger, you can specify the type of event that initiates it (e.g., Tailor DB data update and StateFlow creation) and outline the specific conditions or criteria for its execution.
In this trigger, you can specify the type of event that initiates it (e.g., Tailor DB data update, IdP user changes, or authentication events) and outline the specific conditions or criteria for its execution.

Refer [Supported Events](/guides/events) to learn about the different types of events supported in the Tailor Platform. Follow the [tutorial](/tutorials/setup-executor/event-based-trigger) for setup instructions.

## Basic Event-Based Trigger Configuration

The following example shows the basic structure of an event-based trigger:
The following example shows the basic structure of an event-based trigger using the SDK:

```typescript {{title:'executors/event-based-executor.ts'}}
import { createExecutor, recordCreatedTrigger } from "@tailor-platform/sdk";
Expand All @@ -34,39 +34,45 @@ export default createExecutor({

## Event Data Access

Event-based triggers provide access to event-specific data through the `args` object. The available data depends on the event type:
Event-based triggers provide access to event-specific data through the `args` object. The available data depends on the event type.

`args.eventType` is available for all event types, indicating which specific event triggered the executor (e.g., `tailordb.type_record.created`). This is useful when an executor listens to multiple event types and needs to differentiate between them.

### TailorDB Events

- `args.eventType` - The type of event that occurred (e.g., `tailordb.type_record.created`)
- `args.namespaceName` - The namespace where the event occurred
- `args.typeName` - The type name of the record
- `args.record` or `args.newRecord` - The record data
- `args.eventType` - The type of event that occurred
- `args.newRecord` - The new/created record data (available for created and updated events)
- `args.oldRecord` - The previous record data (available for updated and deleted events)

### Pipeline Events
### IdP Events

- `args.eventType` - The type of event that occurred (e.g., `idp.user.created`)
- `args.namespaceName` - The namespace where the event occurred
- `args.userId` - The ID of the affected IdP user

### Auth Events

- `args.eventType` - The type of event that occurred (e.g., `auth.access_token.issued`)
- `args.namespaceName` - The namespace where the event occurred
- `args.resolverName` - The name of the resolver
- `args.status` - The execution status (success/failure)
- `args.result` - The resolver execution result

## Properties
### Pipeline Events

**Event-based Trigger Properties**
- `args.eventType` - The type of event that occurred (e.g., `pipeline.resolver.executed`)
- `args.namespaceName` - The namespace where the event occurred
- `args.resolverName` - The name of the resolver
- `args.result` - The resolver execution result (on success)
- `args.error` - The error message (on failure)

| Property | Type | Required | Description |
| ----------- | ------ | -------- | --------------------------------------------------------------- |
| `type` | string | Yes | The type of event that triggers the executor |
| `condition` | string | No | The condition that must be met for the executor to be triggered |
## Operation Types

For detailed operation properties, see the dedicated operation pages:

- [TailorGraphql Operation Properties](tailor-graphql-operation#properties)
- [Webhook Operation Properties](webhook-operation#properties)
- [Function Operation Properties](function-operation#properties)
- [Job Function Operation Properties](job-function-operation#properties)

Refer to the [Tailor Platform Provider documentation](https://registry.terraform.io/providers/tailor-platform/tailor/latest/docs/resources/executor) for more details on executor properties.
- [TailorGraphql Operation](tailor-graphql-operation)
- [Webhook Operation](webhook-operation)
- [Function Operation](function-operation)
- [Job Function Operation](job-function-operation)

## Related Documentation

Expand Down