Quick SummaryTriggers are workflows that can run based on other events that happen in your workspace. Xano offers triggers for:
- Database operations (adds, edits, deletes)
- Realtime events
- Workspace events (currently limited to branching operations)
- MCP Server connections
What are triggers?
Triggers in Xano are workflows that will run only when triggered by another event. You can build triggers for the following events.Event Type | Event |
---|---|
Database | New records |
Record edits | |
Record deletes | |
Table truncate (deleting all records) | |
Realtime | Channel events |
Workspace | New branch |
Branch merge | |
Live branch change | |
MCP Server | Client Connect |
Accessing and Creating Triggers
1
Database Triggers
You can find database triggers on each table by clicking the settings icon in the top-right corner.Click + Add Database Trigger to create a new database trigger.You can specify what Data Sources the trigger will execute on. If no data source is set, then it will execute on all data sources.Select the actions that will activate this trigger.Inserts
Any time a record is added to the tableUpdates
Any time a record is editedDeletes
Any time a record is deletedTruncates
When the content of the database table is clearedFinally, you can set up custom filters so that the trigger only runs if the record matches certain conditions. For example, if you only want the trigger to run if a new order is created for a user, or a new user is created with a certain role.
Database triggers have predefined inputs that contain all of the information you’ll need to build a workflow based on the database event.
This is the contents of the new record — if you’re adding a record, this will contain the contents of the new record, and if you’re updating a record, this will contain the contents of the updated record. On deletes and truncates, this will be empty.
This is the contents of the old record — if you’re deleting or editing a record, this will contain the contents of the record before the change. On inserts and truncates, this will be empty.
The action that activated the trigger. Valid options are
The datasource this trigger has been executed against
Any time a record is added to the tableUpdates
Any time a record is editedDeletes
Any time a record is deletedTruncates
When the content of the database table is clearedFinally, you can set up custom filters so that the trigger only runs if the record matches certain conditions. For example, if you only want the trigger to run if a new order is created for a user, or a new user is created with a certain role.
Database triggers have predefined inputs that contain all of the information you’ll need to build a workflow based on the database event.
new
This is the contents of the new record — if you’re adding a record, this will contain the contents of the new record, and if you’re updating a record, this will contain the contents of the updated record. On deletes and truncates, this will be empty.
old
This is the contents of the old record — if you’re deleting or editing a record, this will contain the contents of the record before the change. On inserts and truncates, this will be empty.
action
The action that activated the trigger. Valid options are
insert
update
delete
truncate
data source
The datasource this trigger has been executed against
2
Realtime Triggers
Realtime triggers are created for each channel. Once you’ve created a realtime channel, click the + Add Channel Trigger button to create a new channel trigger.Select the actions that will activate the trigger.Message
Any time a new message is sent to the channelJoin
Any time someone attempts to join the channelThe Join trigger fires before the user joins the channel, which means it will fire whether or not the user can / is authorized to join that channel. The purpose of this is to allow you to block the user from joining the channel if necessary.To prevent the user from joining, you can return a
Realtime triggers have predefined inputs that contain all of the information you’ll need to build a workflow based on the realtime event.Command
This will be either ‘join’ or ‘message’ depending on what was responsible for executing the trigger.Action and Command currently have the same values, but behind the scenes, the values do not come from the same source. We maintain two separate inputs for the purpose of expanding this functionality in the future.
The channel that this command or message is being sent to
Any options that are provided with the command being sent to the channel
The contents of the command, such as the message body
An internal client ID
Any time a new message is sent to the channelJoin
Any time someone attempts to join the channelThe Join trigger fires before the user joins the channel, which means it will fire whether or not the user can / is authorized to join that channel. The purpose of this is to allow you to block the user from joining the channel if necessary.To prevent the user from joining, you can return a
false
response from the trigger. Anything else will allow the user to join the channel.Realtime triggers have predefined inputs that contain all of the information you’ll need to build a workflow based on the realtime event.
Action
and This will be either ‘join’ or ‘message’ depending on what was responsible for executing the trigger.Action and Command currently have the same values, but behind the scenes, the values do not come from the same source. We maintain two separate inputs for the purpose of expanding this functionality in the future.
Channel
The channel that this command or message is being sent to
commandOptions
Any options that are provided with the command being sent to the channel
payload
The contents of the command, such as the message body
client
An internal client ID
3
Workspace Triggers
Workspace triggers can be created to execute workflows based on certain workspace-wide events. Currently, these are limited to branch changes.You can find workspace triggers by clicking the settings icon in the top-right corner of your workspace dashboard.Click + Add Workspace Trigger to create a new workspace trigger.Select the action(s) that will execute this trigger.Branch Live
Any time a branch status is set to liveBranch Merge
When a branch is mergedBranch New
When a new branch is created
Any time a branch status is set to liveBranch Merge
When a branch is mergedBranch New
When a new branch is created
4
MCP Triggers
MCP triggers can be created to run any time a client connects to the MCP server. This is useful for functions like:
Contains the server information, such as the name and instructions.
An array that contains each tool.
- Logging connections to the MCP server
- Dynamically adjusting server instructions based on other data, such as the user who is connecting
- Restricting tools per connection
toolset
Contains the server information, such as the name and instructions.
tools[]
An array that contains each tool.