Skip to main content

Functions reference

CALL steps invoke functions by function_id. Each function validates its arguments; failures surface as step errors (the run stops along that path).

Build with AI

Use Vibe coding so an assistant can query the semantic schema and wire arguments safely.

For AI assistants

Argument and return shapes, edge cases, and SQL dialect notes live in the flow authoring guide.

Data

semantic.query

Runs SQL against the workspace semantic database (accounts, metrics, conversations, tickets, etc.).

Returns: { "results": [...], "columns": [...], "total_rows": N }

{
"function_id": "semantic.query",
"args": {
"query": "SELECT account_id, name, health_score FROM accounts WHERE churned = 0 LIMIT 100"
}
}

Common tables include accounts, meetings, conversations, tickets, topics, notes, tasks, activities, contacts, workspace_users, account_metrics, and dataset_records('your_dataset') for dataset-backed tables. Column lists and types are documented in the flow authoring guide.

data_connection.query

Runs SQL against a configured external connection (warehouse, CRM mirror, etc.).

Args: data_connection_id, query
Returns: Same general shape as semantic.query.

{
"function_id": "data_connection.query",
"args": {
"data_connection_id": "019b3c9e-aaaa-bbbb-cccc-ddddeeeeffff",
"query": "SELECT id, name FROM companies WHERE updated_at > current_timestamp - interval '1' day"
}
}

accounts.select

Returns account IDs matching a filter group (AND of OR groups of filters)—the same structured filters used elsewhere in FunnelStory.

Returns: { "total_count": N, "account_ids": ["..."] }

{
"function_id": "accounts.select",
"args": {
"filter": {
"and_group": [
{
"or_group": [
{
"filter": {
"name": "",
"metric_filter": {
"metric_id": "product_engagement",
"condition": "equal",
"value": "daily_active"
}
}
}
]
}
]
}
}
}

Metric and activity IDs are workspace-specific—look them up in your configuration; do not guess.

Datasets

dataset.record.upsert

Creates or replaces a record keyed by string key.

Returns: { "dataset": "...", "key": "..." }

{
"function_id": "dataset.record.upsert",
"args": {
"dataset": "qbr_notes",
"key": "{{ $.account_id }}",
"record": {
"summary": "$.llm_output",
"updated_at": "{{ $.now }}"
}
}
}

Use quoted "$.var" form when passing whole objects; use {{ $.id }} for string interpolation inside SQL or text.

dataset.record.set_field

Updates a single field on an existing record.

dataset.record.delete

Deletes a record by key.

Communication

slack.send_message

Required: connection_id, channel_id, and at least one of text or blocks.

Returns: { "success": true, "response_channel": "...", "response_timestamp": "..." }

{
"function_id": "slack.send_message",
"args": {
"connection_id": "slack_conn_123",
"channel_id": "C01234567",
"text": "{{ $.message }}"
}
}

email.send

Required: to, subject, body (plain text). html is optional; body is still required.

Optional: cc, bcc, send_separately, data_connection_id. from is required when data_connection_id is set.

Returns: { "sent": true, "recipients": [...], "recipient_count": N }

{
"function_id": "email.send",
"args": {
"to": ["owner@acme.com", "csm@acme.com"],
"cc": ["lead@acme.com"],
"bcc": [],
"send_separately": false,
"subject": "Weekly summary",
"body": "Your weekly summary is ready",
"html": "<p>Your weekly summary is ready</p>"
}
}

Connection-backed send (requires data_connection_id and from):

{
"function_id": "email.send",
"args": {
"data_connection_id": "019b3c9e-...",
"from": "hello@acme.com",
"to": ["owner@acme.com", "csm@acme.com"],
"subject": "Weekly summary",
"body": "Your weekly summary is ready"
}
}

CRM

salesforce.read_record / salesforce.update_record

Args: data_connection_id, object_type, record_id, plus fields array for reads or fields object for updates.

salesforce.create_record

Args: data_connection_id, object_type (sObject API name), fields (non-empty object — create body; values may be strings, numbers, booleans, or nested objects where Salesforce accepts them).

Returns: { "id": "<Salesforce Id>", "ok": true }

hubspot.read_record / hubspot.update_record

Args: data_connection_id, object_type (e.g. companies), record_id, and fields as above.

Utility

tasks.create

Creates a FunnelStory task. Title can be driven from template fields; see the flow authoring guide for optional priority, assignee, due date, actions, and references.

template.render

Renders a stored message template by template_id with a vars map.

search.web

Runs a web search; optional recency_filter: 7d, 30d, 90d, 1y.