Set preferences outside of the subscription center
A subscription center helps you differentiate between the types of messages you send and lets your audience decide what kinds of campaigns and messages they want to receive. Your customers can update their preferences from within your Customer.io messages or other locations including, but not limited to, account creation.
How it works
Customer.io’s Subscription Center feature lets your audience set their subscription preferences when they click Unsubscribe or Manage your preferences in your messages. But you might want to let your audience proactively manage their preferences as a part of your sign-up flow or elsewhere.
You can set your audience’s subscription preferences using the reserved cio_subscription_preferences
attributeA 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.. Each topic in the attribute is numbered, based on the ID that you see in the UI—topic_1
corresponds to ID 1 in the left-column in your Subscription Center setup page. We set subscription preferences by topic ID rather than the topic Name, so that you can change the name of a topic without affecting your audience’s preferences. For each topic, true
means that a person is subscribed to a topic; false
means they’re unsubscribed.
You’ll set this attribute—either through the API, a CSV upload, a Create or Update Person action, or Database sync—to apply preferences to a person.
{
"cio_subscription_preferences": {
"topics": {
"topic_1": true,
"topic_2": false
}
}
}


Check your payload
Applying subscription preferences incorrectly prevents us from observing your audience’s preferences, and can result in extra, misapplied attributes that clutter your workspace.
Your subscription center starts your relationship with your audience on the right foot by letting them tell you which types of messages they’re interested in.
Javascript/Web SDK: Set preferences
If you use our JavaScript snippet, you can set preferences with the identify
function. You can identify a person when they first sign up for your service and set their preferences or when they update their preferences in a settings page that you make available to them.
You’ll set preferences with the cio_subscription_preferences
key.
_cio.identify({
// request must contain an identifier like `id` or `email`, depending on the settings in your workspace
email: 'cool.person@example.com',
cio_subscription_preferences: JSON.stringify({ topics: { topic_1: true, topic_2: false, topic_3: true } })
});
You must stringify the values in order for the attribute to successfully update on the person’s profile.
API: Set preferences
If you have your own backend integration, you can send subscription preferences to your workspace from the /v1/customers
endpoint.
In order to update some preferences, while preserving those set for other topics, use JSON dot notation "cio_subscription_preferences.topics.topic_<topic ID>":<boolean>
.
preferences='
{
"cio_subscription_preferences": {
"topics": {
"topic_1": true,
"topic_2": false
}
}
}
'
echo $preferences | curl --request PUT \
--url https://track.customer.io/api/v1/customers/cool.person@email.com \
--header "Authorization: Basic $(echo -n site_id:api_key | base64)" \
--header 'content-type: application/json' \
--data @-