(Subscribers.Notifications)
- Feed - Get in-app notification feed for a particular subscriber
- UnseenCount - Get the unseen in-app notifications count for subscribers feed
Get in-app notification feed for a particular subscriber
package main
import(
"context"
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Subscribers.Notifications.Feed(ctx, operations.SubscribersV1ControllerGetNotificationsFeedRequest{
SubscriberID: "<id>",
Payload: novugo.String("btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30="),
})
if err != nil {
log.Fatal(err)
}
if res.FeedResponseDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SubscribersV1ControllerGetNotificationsFeedRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerGetNotificationsFeedResponse, 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 the unseen in-app notifications count for subscribers feed
package main
import(
"context"
novugo "github.com/novuhq/novu-go"
"log"
)
func main() {
ctx := context.Background()
s := novugo.New(
novugo.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Subscribers.Notifications.UnseenCount(ctx, "<id>", nil, nil, nil)
if err != nil {
log.Fatal(err)
}
if res.UnseenCountResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
seen |
*bool | ➖ | Indicates whether to count seen notifications. |
limit |
*float64 | ➖ | The maximum number of notifications to return. |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerGetUnseenCountResponse, 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 | */* |