Searching and Filtering Contacts with Advanced Queries

RapidPro.app lets you search contacts using query expressions based on names, URNs, and contact field values, which you can use in the Contacts search bar, the Start Flow dialog, and Smart Groups to segment audiences, find missing or inactive records, and power automation with logical operators and field-type-aware comparisons.

Search contacts using queries (not just names)

If you just need the essentials, follow this:

  1. Use queries in the Contacts search bar (and the Start Flow dialog)
  2. Match exact values with = and exclude with !=
  3. Find partial matches with has (or ~)
  4. Use > < >= <= only with Number or Date & Time fields
  5. Combine rules with AND, OR, and parentheses for clarity
  6. Turn a search into a Smart Group to keep it updated automatically

You’re done. You can now segment contacts and reuse the same query across searches, flows, and Smart Groups.

Step-by-Step Process

1
Know where you can use contact searches

You can search for contacts by name or URN, and you can also use queries based on contact field values.

You can enter search queries in:

  • the Contacts tab search bar
  • the Start Flow dialog (to select contacts or groups)
  • Smart Group creation (to keep a segment updated automatically)

[CAPTURE: Contacts tab search bar with a query entered.]

2
Understand how queries evaluate fields

  • Queries operate on contact fields in your workspace.
  • Field names and values are not case-sensitive.
  • Queries support logical operators like AND and OR.

Basic operators

Equal (=) finds contacts where a field exactly matches a value (example: hair = “blonde”).

Not equal (!=) finds contacts where a field does not match a value (example: student_id != “001”).

3
Search text, names, and phone numbers using partial matches

Use has (or ~) to find partial matches in text values.

Examples:

  • tel has “779” (matches contacts whose phone number contains 779)
  • name has “Be” (matches contacts whose name contains Be)
💡
Tip: has and ~ behave the same and are useful for flexible matching.

4
Search numeric and date fields using comparisons

Use >, <, >=, and <= only with Number or Date & Time fields.

Example (age range): age >= “18” AND age <= “30”

⚠️
Note: Comparison operators do not work on Text fields.

5
Find empty or filled fields

To find contacts where a field is empty (null), compare the field to an empty string.

  • Empty field: fields.gender = “”
  • Non-empty field: fields.gender != “”

Field naming rules in queries

  • Fields with multiple words must use underscores.
  • Do not use spaces in field names inside queries.

Example: id_number = “409328”

6
Combine conditions and create Smart Groups

Using AND / OR

  • OR: city = “Oakland” OR city = “Berkeley”
  • AND: city = “Oakland” AND gender = “Male”

For clarity when combining multiple conditions, use parentheses.

Smart Groups

Groups created from queries are called Smart Groups. Smart Groups automatically update: they continuously include contacts that match the query and remove contacts when they no longer match.

Create a Smart Group from a search

  1. Enter a query in the Contacts search bar.
  2. Review the matching contacts.
  3. Click Create Smart Group.
  4. Name the group and save.

[CAPTURE: Contacts search results with “Create Smart Group” button visible.]
[CAPTURE: Smart Group creation dialog.]

Common use cases include finding contacts missing required information, segmenting by age/location/status, identifying dormant contacts, and building audiences for campaigns or cleanup flows.

Common Issues & Quick Fixes

Problem: My query returns no results.

Fix: Verify the field name in Contacts → Fields, confirm the field actually has values for your contacts, and make sure the operator matches the field type (Text vs Number vs Date & Time).

Problem: Comparison operators (>, <, >=, <=) don’t work.

Fix: This usually means the field is a Text field. Use exact/partial matching instead, or change the field type to Number or Date & Time if that fits your use case.

Problem: My Smart Group doesn’t update.

Fix: Re-check the query logic and confirm it still matches the contacts you expect. Edit the Smart Group query and re-test it in the Contacts search bar.