(Subscribers.Preferences)
ListLegacy- Get subscriber preferences⚠️ DeprecatedRetrieveByLevelLegacy- Get subscriber preferences by level⚠️ Deprecated- UpdateLegacy - Update subscriber preference
- Retrieve - Get subscriber preferences
- Update - Update subscriber global or workflow specific preferences
Get subscriber preferences
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")),
)
res, err := s.Subscribers.Preferences.ListLegacy(ctx, "<id>", nil, nil)
if err != nil {
log.Fatal(err)
}
if res.UpdateSubscriberPreferenceResponseDtos != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
includeInactiveChannels |
*bool | ➖ | A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerListSubscriberPreferencesResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get subscriber preferences by level
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")),
)
res, err := s.Subscribers.Preferences.RetrieveByLevelLegacy(ctx, operations.ParameterTemplate, "<id>", nil, nil)
if err != nil {
log.Fatal(err)
}
if res.GetSubscriberPreferencesResponseDtos != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
preferenceLevel |
operations.Parameter | ✔️ | the preferences level to be retrieved (template / global) |
subscriberID |
string | ✔️ | N/A |
includeInactiveChannels |
*bool | ➖ | A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerGetSubscriberPreferenceByLevelResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Update subscriber preference
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")),
)
res, err := s.Subscribers.Preferences.UpdateLegacy(ctx, "<id>", "<id>", components.UpdateSubscriberPreferenceRequestDto{}, nil)
if err != nil {
log.Fatal(err)
}
if res.UpdateSubscriberPreferenceResponseDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
workflowID |
string | ✔️ | N/A |
updateSubscriberPreferenceRequestDto |
components.UpdateSubscriberPreferenceRequestDto | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerUpdateSubscriberPreferenceResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get subscriber global and workflow specific preferences
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")),
)
res, err := s.Subscribers.Preferences.Retrieve(ctx, "<id>", nil)
if err != nil {
log.Fatal(err)
}
if res.GetSubscriberPreferencesDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersControllerGetSubscriberPreferencesResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Update subscriber global or workflow specific preferences
package main
import(
"context"
"os"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")),
)
res, err := s.Subscribers.Preferences.Update(ctx, "<id>", components.PatchSubscriberPreferencesDto{
Channels: components.PatchPreferenceChannelsDto{},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.GetSubscriberPreferencesDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
patchSubscriberPreferencesDto |
components.PatchSubscriberPreferencesDto | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersControllerUpdateSubscriberPreferencesResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 414 | application/json |
apierrors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.ErrorDto | 500 | application/json |
apierrors.APIError | 4XX, 5XX | */* |