KnockDocs

Users

A User represents a person who may need to be notified of some action occurring in your product.

Sending user data

If you've used a Customer Data Platform (CDP) like Segment before, sending data to Knock will be familiar to you.

The User identifier

The identifier for a user is important as it's the unique key that we will use to merge users and determine recipients for a notification. Generally, the best practice here is to use your internal identifier for your users as the id.

Required attributes

The following attributes are required for each user you identify with Knock.

PropertyDescription
idAn identifier for this user from your system, should be unique
emailThe primary email address for this user
nameThe full name of this user

Optional attributes

The following attributes are optional, depending on the channel types you decide to use with Knock.

PropertyDescription
avatarA URL for the avatar of the user
phone_numberThe E.164 phone number of the user. Knock needs this to send recipients SMS notifications

Storing user traits

In addition to the system attributes defined on the user schema above, Knock will keep track of any properties (key/value pairs) that you send to us. These traits are always merged onto a user and returned to you.

Traits are useful for when you need to perform additional personalization on a user, like de-normalizing the current plan they're on so you can use this to determine the portion of a notification they should receive.

You can nest the properties you send as deeply as you like, but please remember that we will not deep merge these keys.

The user object

Once sent to Knock, the user object returned to you in the Knock payload looks like this:

PropertyDescription
idThe unique user identifier
propertiesA map containing the traits sent for this user
preferencesThe preference object associated with this user
updated_atThe last time in which we updated the user