Getting started with objects and collections
When you identify people or send events, you associate data with a person. But what if you want to manage data for a company, a series of educational courses, or other entities? That's what objects and collections are for in Customer.io: they provide ways to manage non-people data and associate it with people!
How it works
Customer.io revolves around people. You identify people, set their attributes, and send events representing the things that they do on your websites or in your apps. But you might want to maintain some data independently of people and associate this data with people later. Maybe you manage multiple accounts, and people can belong to one or more accounts; or people in your environment can enroll in educational courses; or you might manage recreational sports leagues that people can join.
This is where Objects and Collections come in. But how do you decide which one to use?
- Objects are a better fit when the data is tied to people. You can relate an object to people, trigger an automation when an object or relationship changes, and update a single object at any time.
- Collections work well for reference data you’d otherwise store in a spreadsheet, like a product catalog, a list of upcoming events, or a set of coupons. Collections are free on Premium and Enterprise plans. You can create a collection from a JSON file, a CSV file, or a Google Sheet. But changes to a collection don’t trigger automations.
For example, imagine that you offer online courses. If you store each course as an object, you can relate students to the courses they enroll in, and trigger an automation when a course changes, like when its start date moves. If you store your course catalog as a collection, you can’t trigger an automation when the catalog changes. But you can keep every course in one place and look up course details in your automation workflows, like a weekly email that recommends new courses. You can also use both: store courses as objects to message enrolled students, and store your teachers and facilities as a collection that you reference in those messages to add context for course offerings.
You should also consider how objects and collections connect to people. You can set relationships between people and objects, which last until you delete them. Collections aren’t related to people. You can query a collection in an automation workflow, and use the data throughout the workflow and its messages. But after a person exits the automation there’s no lasting connection between the person and the collection data.
| Objects | Collections | |
|---|---|---|
| Relationships to people | Relationships that last until you delete them | None. You look up collection data in an automation. |
| Updating data | You can update an individual object at any time. | You can replace the whole collection, change individual rows by key with the API, or sync files from cloud storage on a schedule. |
Objects
An Object is a grouping mechanism in Customer.io—a way to associate people with an account, online courses, or recreational sports leagues.
You’ll set up an object with its own attributes A key-value pair that you associate with a person or an object—like a person's name, the date they were created in your workspace, or a company's billing date etc. Use attributes to target people and personalize messages. A group of people who match a series of conditions. People enter and exit the segment automatically when they match or stop matching conditions. A syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person's first name, you might use the variable {{customer.first_name}}.
In an automation, a Query Objects action can find the objects that match your conditions, including objects a profile isn’t related to, and save them for later steps.
Objects are a bit like people in that they can contain attributes, and changes to them can trigger messages, but they can’t receive messages or perform events themselves. Rather, when you target an object, you’re really associating data or sending messages to people who are “related to” an object—like messaging a group of people when an online course changes or when they have new charges associated with their account.
Collections
A Collection is data that exists independently of people and objects. You query a collection in a workflow A series of actions (messages, attribute updates, etc) that people progress through as a part of an automation or broadcast.
Collections are a good fit for reference data that you want to keep current without replacing it. After you give a collection a key field, you can add, update, and delete individual rows, or sync a folder in your cloud storage so that Customer.io loads each new or changed file for you. In an automation, a Query Collection action retrieves the rows that match your conditions, and you can sort the results before you save them to a journey attribute or a profile attribute.
To get started, see Collections.