> For the complete documentation index, see [llms.txt](https://developers.mobile-text-alerts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.mobile-text-alerts.com/tutorials/manage-subscribers/group-subscribers/adaptive-groups.md).

# Adaptive Groups

With Adaptive Groups, you can automatically segment subscribers based on predefined criteria. Once configured, these groups auto-populate with subscribers who meet the defined conditions, without manual intervention. This ongoing audience segmentation enables targeted messaging for smarter, data-driven campaigns.

This page explains how to create and configure Adaptive Groups using the Mobile Text Alerts API. [Click here](https://mobile-text-alerts.deskpro.com/kb/articles/adaptive-groups) for more details about using Adaptive Groups in the platform dashboard.

## Manage Adaptive Groups with the API

Adaptive Groups use the same API endpoints as standard groups for all actions, but they use additional request fields for Adaptive Group settings.

### Create an Adaptive Group

Adaptive Groups are created using the same `POST` [`/groups` endpoint](/tutorials/manage-subscribers/group-subscribers.md#create-a-new-group) used for standard groups. A group will be stored as an Adaptive Group when the `settings` field is included in the request body.

`settings` **object definition:**

```
interface IGroupSettings {
match: 'AND' | 'OR';
conditions: IGroupCondition[];
}
```

`match: 'AND' | 'OR'` *required* - Determines which `conditions` (detailed below) must be met for a subscriber to be added to a group:

* `AND` - A subscriber needs to meet *all* conditions.
* `OR` - A subscriber needs to meet *any* condition.

In the platform dashboard, this is shown as "All conditions" (`AND`) and "Any condition" (`OR`) when creating or editing an Adaptive Group.

<figure><img src="/files/y7JxPm25NoJUxDnYRdde" alt=""><figcaption><p>How the match field is selected in the platform dashboard</p></figcaption></figure>

`conditions: IGroupCondition[]` *required* - Contains the rules or conditions of an Adaptive Group.

<pre><code>type IGroupCondition = {
    type: string;
    conditionAttribute: string;
    conditionOperator: IGroupOperator;
<strong>    conditionValue: (string | number)[];
</strong>};
</code></pre>

See below for details on the subfields:

* `type: string` *required* - Identifies the data type of the attribute referenced in the rule. For preset attributes, the types are as follows:
  * First Name: `"string"`
  * Last Name: `"string"`
  * Phone Number: `"number"`
  * Email: `"string"`
  * Opt-In Source: `"number"` - Set of [hardcoded values that map to IDs](#opt-in-source-ids)
  * Join Date: `"date"`
  * Clicked Link: `"number"` - The numeric ID corresponding to the desired short link.
  * Groups: `"number"` - The numeric ID corresponding to the desired group.
* `conditionAttribute: string` *required* - Defines the field that will be checked when the Adaptive Group rules are evaluated. The preset attributes are as follows:
  * ```
    enum IGroupConditionAttribute { 
        FIRST_NAME = 'firstName', 
        LAST_NAME = 'lastName',
        EMAIL = 'email', 
        PHONE_NUMBER = 'number', 
        JOIN_DATE = 'date', 
        SIGN_UP_METHOD = 'signUpMethod', 
        CLICKED_LINK = 'linkClickTracking', 
        CUSTOM_FIELD = 'custom-' 
    } 
    ```

{% hint style="info" %}
*You can use `CUSTOM_FIELD` to reference* [*Custom Subscriber Attributes*](/tutorials/custom-subscriber-attributes.md) *that have been created on your account. For the value, use the custom field ID to reference the specific field as follows: `'custom-<customFieldId>'`. Call the* [*GET /custom-fields endpoint*](/tutorials/custom-subscriber-attributes.md#get-custom-fields) *to retrieve the `customFieldId` values for attributes on your account.*

*Note that the type of this field must match the type of the specific custom attribute.*
{% endhint %}

* `conditionOperator: string enum` *required* - This comparison expression determines how the attribute is compared to the chosen value. This must be one of the following `enum` values:

  ```ts
  enum IGroupOperator {
    EQUALS = 'equals',
    NOT_EQUALS = 'not equals',
    CONTAINS = 'contains',
    STARTS_WITH = 'starts with',
    ENDS_WITH = 'ends with',
    GREATER_THAN = 'greater than',
    LESS_THAN = 'less than',
    IS_EMPTY = 'is empty',
    IS_NOT_EMPTY = 'is not empty',
    BETWEEN = 'between',
    NOT_BETWEEN = 'not between',
    IS_TRUE = 'is checked',
    IS_FALSE = 'is not checked',
  }
  ```
* `conditionValue: (string | number)[]` *required* - This is the value that the subscriber attribute will be compared against. The type of this value must match the type listed in the `type` field.

{% hint style="info" %}

#### Optional Advanced Settings

The `settings` field can also contain optional fields `conditionSubOperator` and `conditionSubValue`. These fields add an additional layer of comparison and complexity. They are recommended only for advanced users.
{% endhint %}

<details>

<summary>List of Opt-In Source IDs</summary>

```
OPT_IN_MESSAGE = 1,
SIGN_UP_FORM = 2,
CONTROL_PANEL = 3,
SPREADSHEET_IMPORT = 4,
API = 5,
ACTIVE_DIRECTORY_SYNC = 6,
BLESS_IMPORT = 7,
CONSTANT_CONTACT = 8,
SONLET_SYNC = 9,
THIRD_PARTY_SYNC = 9,
BLESS_REGISTRATION = 10,
MANUAL_ENTRY = 11,
ZIPWHIP_SYNC = 12,
OPT_IN_WEB_BANNER = 13,
ZAPIER_SYNC = 14,
SHOPIFY_SYNC = 15,
HUBSPOT_SYNC = 16,
KEYWORD = 17,
QR_CODE = 18,
WEBINAR_IMPORT = 19
```

</details>

#### Example `settings` configuration for an Adaptive Group

Let's create an Adaptive Group with two conditions. If a subscriber meets either condition, they will be added to the group.

If a subscriber matches any of these conditions, they will be added to the group, so `match: "OR"`.

* **Join Date is between 06/01/2025 to 06/30/2025**
  * The following shows how this would be mapped to fields:
    * `"type": "date"` - The Join Date field uses the type `"date"`.
    * `"conditionAttribute": "date"` - The Attribute Name for Join Date is just `"date"`.
    * `"conditionOperator": "between"` - The comparison being configured is **between** two dates.
    * `"conditionValue": ["2025-06-01 04:00", "2025-06-30 04:00"]` - The start and end range of the "between" comparison are provided as an array with two date strings.
* **Email ends with "@yourorg.com"**
  * The following shows how this would be mapped to fields:
    * `"type":"string"` - The Email field uses the type `"string"`.
    * `"conditionAttribute":"email"` - The Attribute Name for Email is `"email"`.
    * `"conditionOperator":"ends with"` - Here we want to look for matching domains of the email address, so `"ends with"` is used.
    * `"conditionValue":["@yourorg.com"]` - The string value that the subscriber email will be compared against to see if it matches `"ends with"`.

Below shows how this is displayed in the platform dashboard:

<figure><img src="/files/AArNSUoEspXOxey4N7vL" alt=""><figcaption><p>Example Adaptive Group conditions shown in the platform dashboard</p></figcaption></figure>

Complete `settings` configuration for this example:

```json
"settings":
    {"match":"OR",
    "conditions": [
        {"type":"date",
        "conditionAttribute":"date",
        "conditionOperator":"between",
        "conditionValue":["2025-06-01 04:00","2025-06-30 04:00"]},
        
        {"type":"string",
        "conditionAttribute":"email",
        "conditionOperator":"ends with",
        "conditionValue":["@yourorg.com"]}
        ]
    }
```

See [Create Group](/tutorials/manage-subscribers/group-subscribers.md#create-a-new-group) to learn more about this endpoint.

### Update an Adaptive Group

The `settings` field that contains the conditions for an Adaptive Group can be updated at any time by calling the <mark style="color:purple;">`PATCH`</mark> [`/groups/{groupId}`](/tutorials/manage-subscribers/group-subscribers.md#update-groups) endpoint with the identifying `{groupId}` of the group to be updated.

### List Adaptive Groups

By default, Adaptive Groups are **not** listed when calling the `GET` [`/groups`](/tutorials/manage-subscribers/group-subscribers.md#list-all-groups) endpoint. To include Adaptive Groups, add the optional query parameter `filters[includeAdaptive]`.

#### Example query with Adaptive Groups included:

*(Note: the `[]` brackets are escaped characters in the cURL request.)*

{% code overflow="wrap" %}

```bash
curl --location 'https://api.mobile-text-alerts.com/v3/groups?filters%5BincludeAdaptive%5D=true' \
  --header 'Authorization: Bearer <APIKey>'
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.mobile-text-alerts.com/tutorials/manage-subscribers/group-subscribers/adaptive-groups.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
