Skip to main content

Build a Targeted Audience Segment

What it is

A segment in BotBat is a saved set of filter criteria that dynamically groups contacts based on their properties, behaviors, and event history. Unlike a static list that contains a fixed set of contacts, a dynamic segment re-evaluates its criteria every time it is used, automatically including contacts who newly match the conditions and excluding those who no longer qualify. This makes segments a powerful tool for maintaining up-to-date audiences without manual list management.

Segments are built using BotBat's visual query builder, which lets you combine multiple conditions using AND/OR logic, nest condition groups, and reference both contact properties (such as country, subscription plan, or signup date) and behavioral events (such as purchases, logins, or campaign opens). The query builder provides a real-time matching count so you can see exactly how many contacts satisfy your criteria as you build.

Once saved, a segment can be referenced from any part of the platform: as the audience for a campaign, as the enrollment trigger for a workflow, as a filter in analytics dashboards, or as a targeting condition in other segments. This guide walks you through every step of creating a segment, from opening the builder to using the finished segment in a campaign.

When to use

Targeted campaign delivery. You want to send a campaign to a specific subset of your contacts rather than your entire database. For example, you might target customers in a particular geographic region, users on a specific subscription plan, or contacts who signed up within the last 30 days. Building a segment lets you define these criteria once and reuse them across multiple campaigns.

Behavioral targeting and re-engagement. You need to reach contacts based on actions they have or have not taken. For example, you might create a segment of users who made a purchase in the past week to send them a thank-you message, or a segment of users who have not logged into your application in 14 days to trigger a re-engagement campaign. Event-based conditions in the query builder make this straightforward.

Ongoing, self-updating audience management. Rather than manually updating a contact list every time your data changes, you want an audience definition that stays current automatically. Dynamic segments accomplish this by evaluating their criteria at query time, ensuring that new contacts who meet the conditions are included and contacts who no longer qualify are excluded, all without any manual intervention.

Steps

1. Navigate to Customers and Segments

Open the sidebar, click Customers, and select Segments. The Segments page displays a table of all segments in your account, showing the segment name, description, contact count, creation date, and last-used date for each entry.

Segments list page showing existing segments with names, descriptions, and contact counts

If you have not created any segments yet, the page shows an empty state with a prompt to build your first segment. You can also access the segment builder directly from the campaign builder's audience selection step by clicking Create Segment in the audience picker.

2. Open the segment builder

Click the New Segment button in the top-right corner of the Segments page. This opens the segment builder, which consists of a name field, a description field, the visual query builder for defining filter conditions, and a real-time matching count display. The builder is designed to be used without writing any code; all conditions are configured through dropdowns, value selectors, and logical grouping controls.

3. Name and describe your segment

Enter a clear, descriptive name for the segment. Good segment names communicate both the criteria and the intent at a glance. For example, "Premium Plan Users in Europe" or "Purchased in Last 30 Days" are much more useful than generic names like "Segment 1" or "My Segment."

Optionally, add a description that provides additional context about why this segment exists, what campaigns or workflows it is intended for, or any nuances about the filter logic. Descriptions are especially helpful when multiple team members share the same BotBat account, as they reduce ambiguity and prevent accidental misuse.

4. Add property-based filter conditions

Use the query builder to add conditions based on contact properties. Click Add Condition and select a property from the dropdown. Then choose an operator and provide the comparison value. The available operators adapt based on the property type.

Query builder showing property filter conditions with dropdown selectors for property, operator, and value
Property TypeAvailable OperatorsExample Condition
Textequals, not equals, contains, starts with, is emptycity equals London
Numberequals, greater than, less than, between, is emptyage is greater than 25
Datebefore, after, between, in the last N days, is emptysignup_date in the last 30 days
Booleanis true, is falseemail_verified is true
List / Enumis one of, is not one ofplan is one of Premium, Enterprise

You can add multiple property conditions to a single segment. By default, conditions within the same group are combined with AND logic, meaning a contact must satisfy every condition to be included. This is the most common pattern for narrowing an audience to a precise group.

5. Add event-based conditions

Click Add Condition and switch the condition type from Property to Event. Event-based conditions let you filter contacts based on actions they have performed (or not performed) within a specified time window.

Query builder showing an event-based condition with event name, frequency, and time window selectors

Event conditions are defined by three components: the event name (such as purchase, app_login, or email_opened), the frequency threshold (at least N times, at most N times, or exactly N times), and the time window (in the last 7 days, in the last 30 days, between specific dates, or any time). For example:

  • Contact has performed purchase at least 1 time in the last 30 days
  • Contact has not performed app_login in the last 7 days
  • Contact has performed email_opened at least 3 times in the last 14 days

Event-based conditions depend on event tracking being properly configured. If the event you reference is not being sent to BotBat from your application or integration, the condition will not match any contacts regardless of what those contacts have actually done. Verify in Settings > Events that the event name you are using is actively being tracked.

6. Use AND/OR logic and condition groups

For more complex targeting, combine conditions using AND and OR operators. Conditions within the same group use AND logic by default (all must be true). To create an OR relationship, add a new condition group. Contacts that match any one of the OR groups are included in the segment.

Query builder displaying multiple condition groups connected with AND and OR operators
Logic TypeBehaviorExample
AND (within a group)Contact must match all conditions in the groupcountry equals US AND plan equals Premium
OR (between groups)Contact must match at least one groupGroup 1: country equals US OR Group 2: country equals UK
Nested AND + ORGroups combined for complex logic(country is US AND plan is Premium) OR (country is UK AND plan is Enterprise)

A common mistake is using AND logic between contradictory conditions, such as country equals US AND country equals UK, which will always return zero results. When you want to include multiple values for the same property, either use the "is one of" operator within a single condition or create separate OR groups.

7. Apply date range filters

Refine your segment further by applying date range filters. These filters let you narrow results based on when a contact was created, when they were last active, or the value of any custom date property. Date ranges are particularly useful for time-bound campaigns, such as targeting contacts who signed up this month or who have not been active since a specific date.

Date filters support both relative ranges ("in the last 7 days," "in the last 90 days") and absolute ranges ("between January 1 and March 31, 2025"). Relative ranges are recalculated each time the segment is evaluated, making them ideal for ongoing, self-updating segments.

8. Preview the matching contacts

As you add and modify conditions, the query builder displays a real-time count of contacts matching your current criteria. This count updates automatically whenever you change a condition, add a group, or adjust an operator.

Real-time matching count displayed in the query builder alongside the filter conditions

Click Preview to see a sample table of contacts who match the segment. Scan through the sample to verify that the right types of contacts are appearing. If the count is much higher or lower than expected, revisit your conditions. A count that is too high usually indicates a filter that is too broad, while a count of zero suggests conflicting conditions or a property that has no matching data.

9. Save the segment

When you are satisfied with the conditions and the matching count, click Save. The segment is immediately available for use across the platform. You can find it in the Segments list, in the campaign builder's audience picker, and in workflow enrollment settings.

Saved segment detail page showing the segment name, criteria summary, and current contact count

Dynamic segments re-evaluate their criteria every time they are queried. This means the contact count may change between the time you save the segment and the time you use it in a campaign. New contacts who match the criteria will be included, and existing contacts who no longer match will be excluded. This behavior is by design and ensures your campaigns always target the most current audience.

10. Use the segment in a campaign

When creating a campaign, navigate to the audience selection step and choose your newly created segment from the segment picker. The campaign will be sent to all contacts matching the segment criteria at send time. For scheduled campaigns, the segment is evaluated at the moment the campaign dispatches, not when it is created. This ensures last-minute changes to your contact data are reflected in the final audience.

Common pitfalls

Overly broad filter conditions. A segment with only one loose condition, such as country exists or email is not empty, may match your entire contact database. Always combine multiple conditions to narrow the audience to a meaningful, actionable group. Check the real-time count as you build to ensure the size is reasonable for your intended use.

Conflicting AND conditions. Placing contradictory conditions in the same AND group, such as country equals US AND country equals UK, guarantees zero results. When you want contacts from multiple countries, use the "is one of" operator (for example, country is one of US, UK) or create separate condition groups connected by OR logic.

Missing event tracking data. Event-based conditions only work for events that are actively being sent to BotBat from your application, website, or integration. If you build a segment using an event name that does not exist in your tracking data, the condition will never match any contacts. Before using an event condition, go to Settings > Events and confirm that the event is listed and receiving data.

Confusion between dynamic and static behavior. Because segments are dynamic, the contact count can change between the time you save the segment and the time you use it in a campaign. If you need a frozen snapshot of contacts at a specific point in time, export the segment as a CSV and re-import it as a static list instead.

tip

Use the Preview button frequently while building your segment, not just at the end. Preview after adding each condition to see how it affects the matching count and the types of contacts included. This incremental approach makes it much easier to identify which condition is causing unexpected results. If the count drops to zero after adding a new condition, you know exactly which filter to investigate.

  • Segments List
  • New Segment Button
  • Segment Name
  • Property Filter
  • Event Condition
  • AND/OR Logic
  • Date Range Filter
  • Matching Count Preview
  • Save Segment
  • Use in Campaign