Module: Novu::Api::Integrations

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

Overview

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

This module includes methods for creating, retrieving, updating, and deleting integrations. It also includes methods for retrieving channel limit, in-app status, webhook provider status.

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

Instance Method Summary collapse

Instance Method Details

#active_integrationsHash, number

Returns a list of active integrations

Returns:

  • (Hash)

    The list of active integrations.

  • (number)

    status

    • Returns 200 if successful



41
42
43
# File 'lib/novu/api/integrations.rb', line 41

def active_integrations
  get("/integrations/active")
end

#channel_limit(channel_type) ⇒ number

Returns a channel limit

Parameters:

  • `channel_type` (String)

Returns:

  • (number)

    status

    • Returns 200 if successful



92
93
94
# File 'lib/novu/api/integrations.rb', line 92

def channel_limit(channel_type)
  get("/integrations/#{channel_type}/limit")
end

#create_integration(body) ⇒ Hash, number

Creates a new integration.

@bodyparams:

Parameters:

  • `providerId` (String)
  • `channel` (String)
  • `credentials` (Hash)
  • `active` (Boolean)
  • `check` (Boolean)

Returns:

  • (Hash)

    The created integration entity.

  • (number)

    status - The status code. Returns 201 if the intgration has been successfully created.



32
33
34
# File 'lib/novu/api/integrations.rb', line 32

def create_integration(body)
  post("/integrations", body: body)
end

#delete_integration(integration_id) ⇒ Hash, number

Execute a soft delete of a integration given a certain ID.

@pathparams:

Parameters:

  • `integration_id` (Integer)

    The ID of the integration to delete.

Returns:

  • (Hash)

    The retrieved integration.

  • (number)

    status

    • Returns 200 if the integration has been deleted correctly.



81
82
83
# File 'lib/novu/api/integrations.rb', line 81

def delete_integration(integration_id)
  delete("/integrations/#{integration_id}")
end

#in_app_statusnumber

Returns in-app status

Returns:

  • (number)

    status

    • Returns 200 if successful



100
101
102
# File 'lib/novu/api/integrations.rb', line 100

def in_app_status
  get("/integrations/in-app/status")
end

#integrationsHash, number

Returns a list of integrations

Returns:

  • (Hash)

    The list of integrations.

  • (number)

    status

    • Returns 200 if successful



17
18
19
# File 'lib/novu/api/integrations.rb', line 17

def integrations
  get("/integrations")
end

#set_integration_as_primary(integration_id) ⇒ number

Set integration as primary

Parameters:

  • `integration_id` (String)

Returns:

  • (number)

    status

    • Returns 200 if successful



111
112
113
# File 'lib/novu/api/integrations.rb', line 111

def set_integration_as_primary(integration_id)
  post("/integrations/#{integration_id}/set-primary")
end

#update_integration(integration_id, body) ⇒ Hash, number

Update the credentials of a integration.

@pathparams:

Parameters:

  • `integration_id` (Integer)

    The ID of the integration to update.

  • `active` (Boolean)
  • `credentials` (Hash)
  • `check` (Boolean)

Returns:

  • (Hash)

    The updated intgration.

  • (number)

    status

    • Returns 200 if the integration with the integrationId provided has been updated correctly.



69
70
71
# File 'lib/novu/api/integrations.rb', line 69

def update_integration(integration_id, body)
  put("/integrations/#{integration_id}", body: body)
end

#webhook_provider_status(provider_id) ⇒ number

Get webhook support status for provider

Parameters:

  • `provider_id` (String)

Returns:

  • (number)

    status

    • Returns 200 if successful



52
53
54
# File 'lib/novu/api/integrations.rb', line 52

def webhook_provider_status(provider_id)
  get("/integrations/webhook/provider/#{provider_id}/status")
end