Abrova
☰ Docs menu · Segments
Coming soon. Abrova Push is coming soon. This page describes how it will work; it can’t be used yet.

Device Segments

Create dynamic device groups from filter rules — platform, country, language, app version, custom metadata. Use with immediate sends.

Last updated: 27 Oct 2026

Create dynamic groups based on device attributes for targeted messaging.

Available Filter Fields#

platform

android, ios, web

userId

User identifier

appVersion

App version string

country

Country code

language

Device language

metadata.*

Custom fields

Create a Segment#

Node.js SDK

typescript
import { AbrovaPush } from '@abrova/push-node';

const abrovaPush = new AbrovaPush({
  apiKey: 'ab_live_your_api_key',
  serverSecret: 'ab_srv_your_server_secret',
});

const segment = await abrovaPush.segments.create({
  name: 'Premium iOS Users',
  description: 'iOS users with premium subscription',
  filters: [
    { field: 'platform', operator: 'equals', value: 'ios' },
    { field: 'metadata.tier', operator: 'equals', value: 'premium' },
  ],
});

REST API

bash
curl -X POST "https://push-api.abrova.ir/segments" \
  -H "x-api-key: ab_live_your_api_key" \
  -H "x-server-secret: ab_srv_your_server_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium iOS Users",
    "description": "iOS users with premium subscription",
    "filters": [
      { "field": "platform", "operator": "equals", "value": "ios" },
      { "field": "metadata.tier", "operator": "equals", "value": "premium" }
    ]
  }'

Response

json
{
  "id": "seg_abc123",
  "name": "Premium iOS Users",
  "description": "iOS users with premium subscription",
  "color": "#6366f1",
  "filters": [
    { "field": "platform", "operator": "equals", "value": "ios" },
    { "field": "metadata.tier", "operator": "equals", "value": "premium" }
  ],
  "deviceCount": 850,
  "createdAt": "2024-01-15T10:00:00Z"
}

Filter Operators#

OperatorDescription
equalsExact match (platform = "ios")
not_equalsNot equal to (platform != "web")
containsString contains (appVersion contains "2.")
not_containsString does not contain
greater_thanNumeric greater than (metadata.age > 18)
less_thanNumeric less than (metadata.age < 65)
inIn list of values (country in ["US", "CA", "GB"])
not_inNot in list of values
existsmetadata.* key is present (value true) or missing (value false) — metadata.vip exists true
starts_withString starts with — top-level fields only (not metadata.*)
greater_than_or_equalGreater than or equal — top-level fields only (not metadata.*)
less_than_or_equalLess than or equal — top-level fields only (not metadata.*)

Filters are combined with AND. Comparisons on appVersion are version-aware (2.10.0 > 2.9.0), and platform values are matched in lowercase. starts_with, greater_than_or_equal and less_than_or_equal are not in the Node SDK's SegmentFilterOperator type yet.

Note.

The dashboard auto-discovers which metadata.* keys and values your devices actually send — the segment builder suggests real keys from your project, and operator choices adapt to each key's inferred type (string, number, boolean). You can still type any custom metadata.* key you plan to write from your SDK later.

Example Segments#

Android Users in US/Canada

json
{
  "name": "North American Android",
  "filters": [
    { "field": "platform", "operator": "equals", "value": "android" },
    { "field": "country", "operator": "in", "value": ["US", "CA"] }
  ]
}

VIP Users (Custom Metadata)

json
{
  "name": "VIP Members",
  "filters": [
    { "field": "metadata.vip", "operator": "equals", "value": true },
    { "field": "metadata.totalSpent", "operator": "greater_than", "value": 1000 }
  ]
}

Beta Testers on Latest Version

json
{
  "name": "Beta Testers",
  "filters": [
    { "field": "metadata.betaTester", "operator": "equals", "value": true },
    { "field": "appVersion", "operator": "contains", "value": "3." }
  ]
}

Send to Segment#

Send to a segment with an immediate push. Scheduled messages can't target segments; send to a segment immediately.

Node.js SDK

typescript
// Send to segment immediately
await abrovaPush.push.sendToSegment({
  segmentId: 'seg_abc123',
  title: 'Exclusive for Premium!',
  body: 'Check out your member benefits',
});

REST API

bash
curl -X POST "https://push-api.abrova.ir/push/send-to-segment" \
  -H "x-api-key: ab_live_your_api_key" \
  -H "x-server-secret: ab_srv_your_server_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "segmentId": "seg_abc123",
    "title": "Exclusive for Premium!",
    "body": "Check out your member benefits"
  }'

Preview Segment#

Get the match count + a small device sample for a set of filters without saving them. Useful for validating filter logic before creating a segment.

Note.

The dashboard's segment builder shows this preview live in the right panel as you edit — no code needed there. The API + SDK below are for programmatic use (CI checks, batch jobs, custom UIs).

Node.js SDK

typescript
const { count, preview } = await abrovaPush.segments.preview({
  filters: [
    { field: 'platform', operator: 'equals', value: 'ios' },
    { field: 'metadata.tier', operator: 'equals', value: 'premium' },
  ],
  limit: 10, // optional, default 20, max 50
});

console.log(`${count} devices match`);
preview.forEach((d) => console.log(d.deviceId, d.userId));

REST API

bash
curl -X POST "https://push-api.abrova.ir/segments/preview?limit=10" \
  -H "x-api-key: ab_live_your_api_key" \
  -H "x-server-secret: ab_srv_your_server_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": [
      { "field": "platform", "operator": "equals", "value": "ios" },
      { "field": "metadata.tier", "operator": "equals", "value": "premium" }
    ]
  }'

Response

json
{
  "count": 1250,
  "preview": [
    {
      "deviceId": "dev_abc...",
      "platform": "ios",
      "userId": "user_1",
      "topics": ["news", "promos"],
      "metadata": { "tier": "premium", "country": "US" }
    },
    {
      "deviceId": "dev_def...",
      "platform": "ios",
      "userId": "user_2",
      "topics": null,
      "metadata": { "tier": "premium" }
    }
  ]
}

Long metadata string values are truncated to 200 characters (with an ellipsis) in the preview response to keep payloads small.

Was this page helpful?
Report a problem