intermediate5 min read

Actions

Workflow Actions

Actions are what workflows do when their conditions are met. AI for Database supports several built-in actions and a generic webhook for custom integrations.

Send Email

Send an email to one or more recipients. The email body supports Markdown and can include data from query results.

Configuration:

  • To -- email addresses (comma-separated) or a dynamic value from a query column
  • Subject -- plain text with {{variable}} support
  • Body -- Markdown with {{variable}} support and a {{results_table}} helper that renders query results as an HTML table
  • Attachments -- optionally attach query results as a CSV file

Example subject: "Alert: {{row_count}} overdue invoices found"

Post to Slack

Send a message to a Slack channel. Requires the Slack integration to be configured in Settings > Integrations.

Configuration:

  • Channel -- select from your Slack workspace's channels
  • Message -- Markdown text with variable support
  • Include table -- attach query results as a formatted Slack table
  • Thread -- optionally post as a thread reply to a previous message

Call Webhook

Send an HTTP request to any URL. This is the most flexible action and can integrate with thousands of tools.

Configuration:

  • URL -- the endpoint to call
  • Method -- GET, POST, PUT, PATCH, or DELETE
  • Headers -- custom headers (e.g., Authorization)
  • Body -- JSON template with variable support

Example body:

json
{
  "text": "{{row_count}} new signups today",
  "data": {{results_json}}
}

Run Query

Execute an additional SQL query as an action. This is useful for writing to log tables, updating status fields, or calling stored procedures.

Note: this requires a database user with write permissions, which is separate from the default read-only connection.

Action Chaining

You can add multiple actions to a single workflow. Actions execute in order and each one has access to the results of all previous steps. If an action fails, subsequent actions are skipped by default (configurable).