(Subscribers.Messages)
- MarkAs - Mark a subscriber messages as seen, read, unseen or unread
- MarkAll - Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
- UpdateAction - Mark message action as seen
Mark a subscriber messages as seen, read, unseen or unread
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_API_KEY")),
)
res, err := s.Subscribers.Messages.MarkAs(ctx, "<id>", components.MessageMarkAsRequestDto{
MessageID: components.CreateMessageIDStr(
"<id>",
),
MarkAs: components.MarkAsUnread,
})
if err != nil {
log.Fatal(err)
}
if res.MessageResponseDtos != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
messageMarkAsRequestDto |
components.MessageMarkAsRequestDto | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersControllerMarkMessagesAsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 400, 404, 409 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed.
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_API_KEY")),
)
res, err := s.Subscribers.Messages.MarkAll(ctx, "<id>", components.MarkAllMessageAsRequestDto{
MarkAs: components.MarkAllMessageAsRequestDtoMarkAsSeen,
})
if err != nil {
log.Fatal(err)
}
if res.Number != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
markAllMessageAsRequestDto |
components.MarkAllMessageAsRequestDto | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersControllerMarkAllUnreadAsReadResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 400, 404, 409 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Mark message action as seen
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_API_KEY")),
)
res, err := s.Subscribers.Messages.UpdateAction(ctx, "<id>", "<value>", "<id>", components.MarkMessageActionAsSeenDto{
Status: components.MarkMessageActionAsSeenDtoStatusDone,
})
if err != nil {
log.Fatal(err)
}
if res.MessageResponseDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
messageID |
string | ✔️ | N/A |
type_ |
any | ✔️ | N/A |
subscriberID |
string | ✔️ | N/A |
markMessageActionAsSeenDto |
components.MarkMessageActionAsSeenDto | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersControllerMarkActionAsSeenResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.ErrorDto | 400, 404, 409 | application/json |
apierrors.ValidationErrorDto | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |