Skip to content

Files

Latest commit

 

History

History
179 lines (133 loc) · 10.5 KB

README.md

File metadata and controls

179 lines (133 loc) · 10.5 KB

Messages

(Messages)

Overview

A message in Novu represents a notification delivered to a recipient on a particular channel. Messages contain information about the request that triggered its delivery, a view of the data sent to the recipient, and a timeline of its lifecycle events. Learn more about messages. https://docs.novu.co/workflows/messages

Available Operations

Retrieve

Returns a list of messages, could paginate using the page query parameter

Example Usage

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.Messages.Retrieve(ctx, operations.MessagesControllerGetMessagesRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ActivitiesResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.MessagesControllerGetMessagesRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.MessagesControllerGetMessagesResponse, error

Errors

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

Deletes a message entity from the Novu platform

Example Usage

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.Messages.Delete(ctx, "<id>", nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.DeleteMessageResponseDto != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
messageID string ✔️ N/A
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.MessagesControllerDeleteMessageResponse, error

Errors

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 */*

DeleteByTransactionID

Deletes messages entity from the Novu platform using TransactionId of message

Example Usage

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.Messages.DeleteByTransactionID(ctx, "<id>", nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
transactionID string ✔️ N/A
channel *operations.Channel The channel of the message to be deleted
idempotencyKey *string A header for idempotency purposes
opts []operations.Option The options for this request.

Response

*operations.MessagesControllerDeleteMessagesByTransactionIDResponse, error

Errors

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 */*