On this page

Query Builder (preview)

Now available for preview

Query Builder is currently in preview. Features and functionality may change.

About

Query Builder extends metrics by adding flexibility and richer logic. It lets you define conditions and relationships in a more natural, visual way.

For example: Get the top 10 users who are most engaged by the count of messages. Get users posting duplicate messages to many channels.

Use the predefined Queries and Decisions in Query Builder to quickly set up ranking and spam detection use cases, view results, and automate the actions you want to trigger.

Query Builder templates

Predefined Queries

In this initial preview release, Query Builder includes four predefined Queries and Decisions with default configurations:

Predefined QueryPurpose / Predefined Decision
Top N
Reward the top 10 users who are most engaged: Top N predefined query
Predefined Decision: Predefined decision reward
Bottom N
Incentivize users who are least engaged: Bottom N predefined query
Predefined Decision: Predefined decision incentive
Cross-posting spam
Detect users sending duplicate messages across multiple channels: Cross-posting spam predefined query
Predefined Decision: Predefined decision flag & optionally restrict
Chat flooding spam
Detect users posting excessive or repetitive messages in a single channel. Chat flooding spam predefined query
Predefined Decision: Predefined decision flag & optionally restrict

Create a Query from a predefined Query

  1. Click Business Object. Query Builder can be found at the top of the main page of the Business Object when at least one Business Object has been created.

    Business Objects page with Query Builder

  2. Choose one of the available predefined Queries. If you don't see the list, click New query.

    Choose a predefined query

  3. Provide a name for your Query.

  4. Add a data source by selecting an active Business Object that is already capturing data.

    You can also select an inactive Business Object, but note that you won't see any data when you run the Query.

    Once a Business Object is selected, the predefined Query automatically preselects the data fields from that object that best match the selected use case. Typically, these fields include User, Channel, and Message Text (or Chat).

    You can edit the Query to meet your use case. The Top N users or Bottom N users can be adjusted to be based on the count of records or rows captured, the count of a specific data field like message chats, the average, sum, max or min of a number data type like purchases or game points.

  5. Choose the time period or window you'd like to use for this Query (for example, last 1 minute, last 10 minutes, last 1 hour).

    Choose the time period or window

  6. After selecting the aggregation window, click Save again to store your configuration.

  7. Optionally, add filters to refine your results. You can also do this after you run the Query.

    Add filters

    Available filters include:

    equals, does not equal, greater than, less than,
    greater than or equal to, less than or equal to,
    is empty, is not empty, between, not between,
    contains, does not contain, starts with,
    ends with, min length, max length
  8. Click Run to execute the Query and view results.

    Run query

    No data appears

    If no data appears, extend the time window (for example, to 1 hour or more) and click Refresh to run the Query again. Don't save the extended time window unless that's the aggregation window you actually want to use.

  9. Check the Query results to verify your setup, add or adjust filters, or refine the Query as needed. When used in a Decision, each row displayed in the Query results represents a condition that can trigger an action.

Create a Decision from a Query

Once you've configured and saved a Query, you can create a Decision that uses the Query results to trigger actions. You can create a Decision using a predefined Decision template or start from scratch.

Both options are available directly from the Query Builder.

To create a Decision:

  1. Save your Query.

  2. Click Create Decision.

    Create Decision button

    Save the Query before creating a Decision

    The Create Decision button is only visible after the Query is saved.

  3. Choose either Predefined or Create from scratch. Depending on the option you choose, the Decision creation flow is different.

Use a predefined Decision

Selecting Predefined automatically creates a Decision tailored to the selected Query template.

What happens automatically:

You can immediately:

To return to the Query at any time, click the Query name displayed at the top below the Decision title.

Create a Decision from scratch

Selecting Create from scratch opens a blank Decision configuration.

  1. Select Create from scratch.

  2. Provide a Decision name (with an optional description).

  3. Configure conditions by selecting one of your saved Queries. The available data fields correspond to those defined in the Query (for example: user, message, channel_count, total_count).

    Configure conditions from query data fields

  4. Add and configure the desired action. Refer to steps 5-11 of Create Decision to learn more.

  5. Create rules that trigger actions when conditions are met. Refer to add conditions and rules.

  6. Activate the Decision.

Last updated on