- List - List topic subscriptions
- Create - Create topic subscriptions
- Delete - Delete topic subscriptions
- GetSubscription - Retrieve a topic subscription
- Update - Update a topic subscription
List all subscriptions of subscribers for a topic. Checkout all available filters in the query section.
using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
TopicsControllerListTopicSubscriptionsRequest req = new TopicsControllerListTopicSubscriptionsRequest() {
TopicKey = "<value>",
Limit = 10D,
ContextKeys = new List<string>() {
"tenant:org-123",
"region:us-east-1",
},
};
var res = await sdk.Topics.Subscriptions.ListAsync(req);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
request |
TopicsControllerListTopicSubscriptionsRequest | ✔️ | The request object to use for the request. |
TopicsControllerListTopicSubscriptionsResponse
| 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 | */* |
This api will create subscription for subscriberIds for a topic. Its like subscribing to a common interest group. if topic does not exist, it will be created.
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Topics.Subscriptions.CreateAsync(
topicKey: "<value>",
createTopicSubscriptionsRequestDto: new CreateTopicSubscriptionsRequestDto() {
Subscriptions = new List<Novu.Models.Components.Subscriptions>() {
Novu.Models.Components.Subscriptions.CreateTopicSubscriberIdentifierDto(
new TopicSubscriberIdentifierDto() {
Identifier = "subscriber-123-subscription-a",
SubscriberId = "subscriber-123",
}
),
Novu.Models.Components.Subscriptions.CreateTopicSubscriberIdentifierDto(
new TopicSubscriberIdentifierDto() {
Identifier = "subscriber-456-subscription-b",
SubscriberId = "subscriber-456",
}
),
},
Name = "My Topic",
Context = new Dictionary<string, CreateTopicSubscriptionsRequestDtoContext>() {
{ "key", CreateTopicSubscriptionsRequestDtoContext.CreateStr(
"org-acme"
) },
},
Preferences = new List<Novu.Models.Components.Preferences>() {
Novu.Models.Components.Preferences.CreateWorkflowPreferenceRequestDto(
new WorkflowPreferenceRequestDto() {
Condition = new Dictionary<string, object>() {
{ "===", new List<object>() {
new Dictionary<string, object>() {
{ "var", "tier" },
},
"premium",
} },
},
WorkflowId = "workflow-123",
}
),
},
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
TopicKey |
string | ✔️ | The key identifier of the topic |
CreateTopicSubscriptionsRequestDto |
CreateTopicSubscriptionsRequestDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
TopicsControllerCreateTopicSubscriptionsResponse
| 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 subscriptions for subscriberIds for a topic.
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Topics.Subscriptions.DeleteAsync(
topicKey: "<value>",
deleteTopicSubscriptionsRequestDto: new DeleteTopicSubscriptionsRequestDto() {
Subscriptions = new List<DeleteTopicSubscriptionsRequestDtoSubscriptions>() {
DeleteTopicSubscriptionsRequestDtoSubscriptions.CreateDeleteTopicSubscriberIdentifierDto(
new DeleteTopicSubscriberIdentifierDto() {
Identifier = "subscriber-123-subscription-a",
SubscriberId = "subscriber-123",
}
),
DeleteTopicSubscriptionsRequestDtoSubscriptions.CreateDeleteTopicSubscriberIdentifierDto(
new DeleteTopicSubscriberIdentifierDto() {
SubscriberId = "subscriber-456",
}
),
DeleteTopicSubscriptionsRequestDtoSubscriptions.CreateDeleteTopicSubscriberIdentifierDto(
new DeleteTopicSubscriberIdentifierDto() {
Identifier = "subscriber-789-subscription-b",
}
),
},
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
TopicKey |
string | ✔️ | The key identifier of the topic |
DeleteTopicSubscriptionsRequestDto |
DeleteTopicSubscriptionsRequestDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
TopicsControllerDeleteTopicSubscriptionsResponse
| 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 | */* |
Retrieve a subscription by its unique identifier for a topic.
using Novu;
using Novu.Models.Components;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Topics.Subscriptions.GetSubscriptionAsync(
topicKey: "<value>",
identifier: "<value>"
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
TopicKey |
string | ✔️ | The key identifier of the topic |
Identifier |
string | ✔️ | The unique identifier of the subscription |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
TopicsControllerGetTopicSubscriptionResponse
| 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 subscription by its unique identifier for a topic. You can update the preferences and name associated with the subscription.
using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Topics.Subscriptions.UpdateAsync(
topicKey: "<value>",
identifier: "<value>",
updateTopicSubscriptionRequestDto: new UpdateTopicSubscriptionRequestDto() {
Name = "My Subscription",
Preferences = new List<UpdateTopicSubscriptionRequestDtoPreferences>() {
UpdateTopicSubscriptionRequestDtoPreferences.CreateWorkflowPreferenceRequestDto(
new WorkflowPreferenceRequestDto() {
Condition = new Dictionary<string, object>() {
{ "===", new List<object>() {
new Dictionary<string, object>() {
{ "var", "tier" },
},
"premium",
} },
},
WorkflowId = "workflow-123",
}
),
},
}
);
// handle response| Parameter | Type | Required | Description |
|---|---|---|---|
TopicKey |
string | ✔️ | The key identifier of the topic |
Identifier |
string | ✔️ | The unique identifier of the subscription |
UpdateTopicSubscriptionRequestDto |
UpdateTopicSubscriptionRequestDto | ✔️ | N/A |
IdempotencyKey |
string | ➖ | A header for idempotency purposes |
TopicsControllerUpdateTopicSubscriptionResponse
| 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 | */* |