Nilovon Connect
SDK

Segments

Group contacts dynamically with filter-based segments.

Segments let you define reusable filters over your contact list — useful for targeting specific audiences.

Create a segment

const segment = await connect.segment.create({
  name: "Email subscribers",
  description: "Contacts with an email address",
  criteria: {
    hasEmail: true,
  },
});

Filter criteria

FieldTypeDescription
querystringFree-text search across name, email, phone
hasEmailbooleanOnly contacts with an email
hasPhonebooleanOnly contacts with a phone number
tagsstring[]Contacts that have all specified tags
await connect.segment.create({
  name: "VIP SMS users",
  criteria: {
    hasPhone: true,
    tags: ["vip"],
  },
});

List segments

const { items } = await connect.segment.list({
  limit: 20,
  offset: 0,
});

Get a segment

const segment = await connect.segment.get({ id: "seg_..." });

Update a segment

await connect.segment.update({
  id: "seg_...",
  name: "Active VIPs",
  criteria: {
    hasEmail: true,
    tags: ["vip", "active"],
  },
});

Delete a segment

await connect.segment.delete({ id: "seg_..." });

On this page