Subscribers
. Each subscriber is unique and identified by a unique subscriberId.
subscriberId
.data
field using key-value pairs.deviceTokens
required to send push notifications and webhookUrl
for chat channel providers can also be stored.Field | Type | Required | Example |
---|---|---|---|
subscriberId | string | true | b0bea066-f5fe-11ed-b67e-0242ac120002 |
firstName | string | false | John |
lastName | string | false | Doe |
string | false | john.doe@domain.org. | |
phone | string | false | +13603963366 |
locale | string | false | en |
avatar | string | false | https://example.com/images/avatar.jpg |
data | object | false | {"key": "value"} |
Ahead of Trigger
means adding subscribers before triggering notification or Just-in-time
means sending complete subscriber data in to
field while triggering.
to
field of the trigger method. If any subscriber with provided subscriberId
does not exists, a new subscriber will be created. In this case, subscriber will be created first and then the trigger will be executed synchronously.
to
fields per the channels in the workflow. For example, if an email step is included in the workflow, then the to.email
field must be specified. Similarly if an SMS step is included, the to.phone
field must be specified.
If you are defining workflows with code, you can use the subscriberId
to hydrate subscriber data directly from your database or other sources during workflow execution. This is useful when you don’t want to store all the subscriber data in Novu.
For example, you may have a welcome onboarding email that you trigger immediately after a user signs up, with the email only sent 1 hour after signup:
subscriberId
and the workflow will fetch the user data from your database in real-time:
subscriberId
is the required field and other fields are optional.
identify
payload. You can call this function during registration or signup to make sure the subscriber data is up-to-date, if you wish to save additional attributes with a subscriber, you can pass additional custom data in the data field as key-value pairs.