A subscriber in Novu represents someone who should receive a message. A subscriber's profile information contains important attributes about the subscriber that will be used in messages (name, email). The subscriber object can contain other key-value pairs that can be used to further personalize your messages. https://docs.novu.co/subscribers/subscribers
- Search - Search subscribers
- Create - Create a subscriber
- Retrieve - Retrieve a subscriber
- Patch - Update a subscriber
- Delete - Delete a subscriber
- CreateBulk - Bulk create subscribers
- UpdateCredentials - Update provider credentials
- AppendCredentials - Upsert provider credentials
- DeleteCredentials - Delete provider credentials
- UpdateOnlineStatus - Update subscriber online status
Search subscribers by their email, phone, subscriberId and name. The search is case sensitive and supports pagination.Checkout all available filters in the query section.
using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
SubscribersControllerSearchSubscribersRequest req = new SubscribersControllerSearchSubscribersRequest() {
Limit = 10D,
};
var res = await sdk.Subscribers.SearchAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
SubscribersControllerSearchSubscribersRequest | ✔️ | The request object to use for the request. |
SubscribersControllerSearchSubscribersResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Create a subscriber with the subscriber attributes. subscriberId is a required field, rest other fields are optional, if the subscriber already exists, it will be updated
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.CreateAsync(createSubscriberRequestDto: new CreateSubscriberRequestDto() {
FirstName = "John",
LastName = "Doe",
Email = "john.doe@example.com",
Phone = "+1234567890",
Avatar = "https://example.com/avatar.jpg",
Locale = "en-US",
Timezone = "America/New_York",
SubscriberId = "<id>",
});
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
CreateSubscriberRequestDto |
CreateSubscriberRequestDto | ✔️ | N/A |
FailIfExists |
bool | ➖ | If true, the request will fail if a subscriber with the same subscriberId already exists |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersControllerCreateSubscriberResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.SubscriberResponseDto | 409 | application/json |
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Retrieve a subscriber by its unique key identifier subscriberId. subscriberId field is required.
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.RetrieveAsync(subscriberId: "<id>");
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
SubscriberId |
string | ✔️ | The identifier of the subscriber |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersControllerGetSubscriberResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Update a subscriber by its unique key identifier subscriberId. subscriberId is a required field, rest other fields are optional
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.PatchAsync(
subscriberId: "<id>",
patchSubscriberRequestDto: new PatchSubscriberRequestDto() {
FirstName = "John",
LastName = "Doe",
Email = "john.doe@example.com",
Phone = "+1234567890",
Avatar = "https://example.com/avatar.jpg",
Locale = "en-US",
Timezone = "America/New_York",
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
SubscriberId |
string | ✔️ | The identifier of the subscriber |
PatchSubscriberRequestDto |
PatchSubscriberRequestDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersControllerPatchSubscriberResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Deletes a subscriber entity from the Novu platform along with associated messages, preferences, and topic subscriptions. subscriberId is a required field.
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.DeleteAsync(subscriberId: "<id>");
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
SubscriberId |
string | ✔️ | The identifier of the subscriber |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersControllerRemoveSubscriberResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Using this endpoint multiple subscribers can be created at once. The bulk API is limited to 500 subscribers per request.
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.CreateBulkAsync(bulkSubscriberCreateDto: new BulkSubscriberCreateDto() {
Subscribers = new List<CreateSubscriberRequestDto>() {
new CreateSubscriberRequestDto() {
SubscriberId = "<id>",
},
},
});
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
BulkSubscriberCreateDto |
BulkSubscriberCreateDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersV1ControllerBulkCreateSubscribersResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Update credentials for a provider such as slack and FCM. providerId is required field. This API creates the deviceTokens or replaces the existing ones.
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.UpdateCredentialsAsync(
subscriberId: "<id>",
updateSubscriberChannelRequestDto: new UpdateSubscriberChannelRequestDto() {
ProviderId = ChatOrPushProviderEnum.Slack,
Credentials = new ChannelCredentials() {
WebhookUrl = "https://example.com/webhook",
Channel = "general",
DeviceTokens = new List<string>() {
"token1",
"token2",
"token3",
},
AlertUid = "12345-abcde",
Title = "Critical Alert",
ImageUrl = "https://example.com/image.png",
State = "resolved",
ExternalUrl = "https://example.com/details",
},
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
SubscriberId |
string | ✔️ | N/A |
UpdateSubscriberChannelRequestDto |
UpdateSubscriberChannelRequestDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersV1ControllerUpdateSubscriberChannelResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Upsert credentials for a provider such as slack and FCM. providerId is required field. This API creates deviceTokens or appends to the existing ones.
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.AppendCredentialsAsync(
subscriberId: "<id>",
updateSubscriberChannelRequestDto: new UpdateSubscriberChannelRequestDto() {
ProviderId = ChatOrPushProviderEnum.OneSignal,
Credentials = new ChannelCredentials() {
WebhookUrl = "https://example.com/webhook",
Channel = "general",
DeviceTokens = new List<string>() {
"token1",
"token2",
"token3",
},
AlertUid = "12345-abcde",
Title = "Critical Alert",
ImageUrl = "https://example.com/image.png",
State = "resolved",
ExternalUrl = "https://example.com/details",
},
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
SubscriberId |
string | ✔️ | N/A |
UpdateSubscriberChannelRequestDto |
UpdateSubscriberChannelRequestDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersV1ControllerModifySubscriberChannelResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Delete subscriber credentials for a provider such as slack and FCM by providerId. This action is irreversible and will remove the credentials for the provider for particular subscriberId.
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.DeleteCredentialsAsync(
subscriberId: "<id>",
providerId: "<id>"
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
SubscriberId |
string | ✔️ | N/A |
ProviderId |
string | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersV1ControllerDeleteSubscriberCredentialsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |
Update the subscriber online status by its unique key identifier subscriberId
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Subscribers.UpdateOnlineStatusAsync(
subscriberId: "<id>",
updateSubscriberOnlineFlagRequestDto: new UpdateSubscriberOnlineFlagRequestDto() {
IsOnline = false,
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
SubscriberId |
string | ✔️ | N/A |
UpdateSubscriberOnlineFlagRequestDto |
UpdateSubscriberOnlineFlagRequestDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
SubscribersV1ControllerUpdateSubscriberOnlineFlagResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Novu.Models.Errors.ErrorDto | 414 | application/json |
| Novu.Models.Errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Novu.Models.Errors.ValidationErrorDto | 422 | application/json |
| Novu.Models.Errors.ErrorDto | 500 | application/json |
| Novu.Models.Errors.APIException | 4XX, 5XX | */* |