Module: Novu::Api::Notification

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

Overview

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

This module includes methods for retrieving notifications, notifications stats and notifications graph stats.

For more information on the Novu API(api.novu.co/api#/Notification), see docs.novu.co/api/.

Instance Method Summary collapse

Instance Method Details

#notification(notification_id) ⇒ Hash, number

Returns a notification

@pathparams:

Parameters:

  • `notification_id` (String)

Returns:

  • (Hash)

    notification entity

  • (number)

    status

    • Returns 200 if successful.



58
59
60
# File 'lib/novu/api/notification.rb', line 58

def notification(notification_id)
  get("/notifications/#{notification_id}")
end

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

Returns a list of notifications 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:

  • `channels` (Array[String])

    Available values : in_app, email, sms, chat, push

  • `templates` (Array[String])
  • `emails` (Array[String])
  • `search` (String(optional))
  • `transactionId` (String(optional))
  • `page` (Integer(optional))

    Number of page for the pagination. Default value is 0

Returns:

  • (Hash)

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

  • (number)

    status

    • Returns 200 if successful.



25
26
27
# File 'lib/novu/api/notification.rb', line 25

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

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

Returns a list of notifications stats

@queryparams:

Parameters:

  • `days` (Integer)

Returns:

  • (Hash)

    notification graph stats.

  • (number)

    status

    • Returns 200 if successful.



46
47
48
# File 'lib/novu/api/notification.rb', line 46

def notifications_graph_stats(query = {})
  get("/notifications/graph/stats", query: query)
end

#notifications_statsHash, number

Returns a list of notifications stats

Returns:

  • (Hash)

    notification stats.

  • (number)

    status

    • Returns 200 if successful.



34
35
36
# File 'lib/novu/api/notification.rb', line 34

def notifications_stats
  get("/notifications/stats")
end