Module: Novu::Api::Messages

Included in:
Client
Defined in:
lib/novu/api/messages.rb

Overview

Module Novu::Api::Messages provides an API for managing messages in the Novu application.

This module includes methods for retrieving, and deleting messages.

For more information on the Novu API(api.novu.co/api#/Messages), see docs.novu.co/api/get-messages/.

Instance Method Summary collapse

Instance Method Details

#delete_message(message_id) ⇒ Hash, number

Deletes a message entity from the Novu platform

@pathparams:

Parameters:

  • `message_id` (String)

    The ID of the message to delete.

Returns:

  • (Hash)

    of acknowledged and status.

  • (number)

    status

    • Returns 200 if the message has been deleted correctly.



35
36
37
# File 'lib/novu/api/messages.rb', line 35

def delete_message(message_id)
  delete("/messages/#{message_id}")
end

#messages(query = {}) ⇒ Hash, number

Returns a list of messages that can be paginated using the ‘page` query parameter and filtered by the environment where it is executed from the organization the user belongs to.

@queryparams:

Parameters:

  • `page` (Integer(optional))

    Number of page for the pagination. The page to fetch, defaults to 0.

  • `limit` (Integer(optional))

    The number of messages to fetch, defaults to 10.

  • `channel` (String(optional))

    The channel for the messages you wish to list.

  • `subscriberId` (String(optional))

    The subscriberId for the subscriber you like to list messages for.

Returns:

  • (Hash)

    The list of messages that match the criteria of the query params are successfully returned.

  • (number)

    status

    • Returns 200 if successful



23
24
25
# File 'lib/novu/api/messages.rb', line 23

def messages(query = {})
  get("/messages", query: query)
end