Skip to main content

Customers as a source

Your customers are a source, without you setting anything up.

Every tenant that uses Customers has a built-in Insights source that exposes all companies, people and groups with all their fields. It is the live customer data: not a copy, not an export, not a nightly sync.

Source idcustomers-entities
NameCustomers Einträge by default (the product word can be renamed per tenant)
CreatedAutomatically
DataThe live entities index

What you can do with it​

Everything you can do with a source, except writing:

  • Charts and dashboards in the Insights app: companies per city, people per role, new customers per month, and so on.
  • aggregate from REST and the SDK: query, filter, sort and aggregate your customers through the Insights API.
  • CSV export.
  • Joins: use it as the lookup in a source enrichment to add customer fields to another source (for example the company's city on every order).
  • Filters made for customers: the chart editor offers quick filters.

Fields​

Every field of your entities appears as data.<field>, plus a few system fields.

FieldMeaning
humanIdThe readable id (SC-ZW2VEG)
entityTypeou, person or group
created, lastChangeTimestamps
lockedBoolean
data.name, data.city, data.legalForm, …Company fields
data.firstName, data.lastName, data.salutation, …Person fields
data.activeActive flag
data.contacts, data.avatarSpecial fields

Field types follow the entity data: text becomes string, numbers integer or float, dates timestamps, locations geo-point. Relations (employees, groups, memberships) are not fields of this source. Use the Customers API for those.

Query customers through Insights​

import sdk from '@scenid/cloud-sdk'

const customers = sdk.asAdmin().Insights().Source('customers-entities')

// Companies per city
const { result } = await customers.aggregate({
aggMode: 'aggregation',
filter: [{ term: { 'entityType.keyword': 'ou' } }],
aggs: [
{
id: 'city',
aggregation: 'terms',
field: 'data.city.keyword',
aggs: [{ id: 'companies', aggregation: 'value_count', field: 'humanId.keyword' }]
}
]
})

The same source works over REST:

curl -s https://insights-service.scenid.cloud/api/v2/source/customers-entities/aggregate \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"size": 5, "fields": ["data.name", "data.city"], "filter": [{ "term": { "entityType.keyword": "ou" } }]}'

Customers API or Insights API?​

Use the Customers API when…Use Insights on customers-entities when…
You create, update or delete customersYou analyse customers: counts, groupings, trends
You need relations: employments, group members, parentsYou combine customers with other data in charts
You need journal entriesYou want dashboards on your customers

Writing always goes through the Customers API. The customers source is read-only: document create, update and delete answer doc/customers-source-not-supported, and it is not available in Sources([...]).Docs.find.

Access​

Users see the source if they have access to Customers. In the Insights app, the customers' group permissions apply to what a user sees. Apps with a service key can read all of it.

Connected in both directions​

Customers and Insights connect in more directions than this:

  • Customers entities are analysed and charted in Insights (this page).
  • The Customers app shows Insights charts on entity pages.
  • Data from other tools can be pushed into Insights sources and joined with customers.