(Subscribers.Credentials)
- Update - Update subscriber credentials
- Append - Modify subscriber credentials
- Delete - Delete subscriber credentials by providerId
Subscriber credentials associated to the delivery methods such as slack and push tokens.
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.Credentials.Update(ctx, "<id>", components.UpdateSubscriberChannelRequestDto{
ProviderID: components.UpdateSubscriberChannelRequestDtoProviderIDPushpad,
Credentials: components.ChannelCredentials{
WebhookURL: novugo.String("https://example.com/webhook"),
Channel: novugo.String("general"),
DeviceTokens: []string{
"token1",
"token2",
"token3",
},
AlertUID: novugo.String("12345-abcde"),
Title: novugo.String("Critical Alert"),
ImageURL: novugo.String("https://example.com/image.png"),
State: novugo.String("resolved"),
ExternalURL: novugo.String("https://example.com/details"),
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.SubscriberResponseDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
updateSubscriberChannelRequestDto |
components.UpdateSubscriberChannelRequestDto | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerUpdateSubscriberChannelResponse, 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 | */* |
Subscriber credentials associated to the delivery methods such as slack and push tokens. This endpoint appends provided credentials and deviceTokens to the existing ones.
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.Credentials.Append(ctx, "<id>", components.UpdateSubscriberChannelRequestDto{
ProviderID: components.UpdateSubscriberChannelRequestDtoProviderIDZulip,
Credentials: components.ChannelCredentials{
WebhookURL: novugo.String("https://example.com/webhook"),
Channel: novugo.String("general"),
DeviceTokens: []string{
"token1",
"token2",
"token3",
},
AlertUID: novugo.String("12345-abcde"),
Title: novugo.String("Critical Alert"),
ImageURL: novugo.String("https://example.com/image.png"),
State: novugo.String("resolved"),
ExternalURL: novugo.String("https://example.com/details"),
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.SubscriberResponseDto != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
updateSubscriberChannelRequestDto |
components.UpdateSubscriberChannelRequestDto | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerModifySubscriberChannelResponse, 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 | */* |
Delete subscriber credentials such as slack and expo tokens.
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.Credentials.Delete(ctx, "<id>", "<id>", nil)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
subscriberID |
string | ✔️ | N/A |
providerID |
string | ✔️ | N/A |
idempotencyKey |
*string | ➖ | A header for idempotency purposes |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SubscribersV1ControllerDeleteSubscriberCredentialsResponse, 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 | */* |