Triggers
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.
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
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 table
Updates Any time a record is edited
Deletes Any time a record is deleted
Truncates When the content of the database table is cleared
Finally, 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
data source
The datasource this trigger has been executed against
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 channel
Join Any time a new connection is made to 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 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.
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
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 live
Branch Merge When a branch is merged
Branch New When a new branch is created
MCP Triggers
MCP triggers can be created to run any time a client connects to the MCP server. This is useful for functions like:
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
You can find MCP triggers by clicking the settings icon in the top-right corner of your MCP server.
Click + Add MCP Server Trigger to create a new MCP server trigger.
MCP Server triggers offer the following inputs:
toolset
Contains the server information, such as the name and instructions.
tools[]
An array that contains each tool.
Last updated
Was this helpful?