Skip to content

Latest commit

 

History

History
471 lines (329 loc) · 38.5 KB

README.md

File metadata and controls

471 lines (329 loc) · 38.5 KB

Integrations

(integrations)

Overview

With the help of the Integration Store, you can easily integrate your favorite delivery provider. During the runtime of the API, the Integrations Store is responsible for storing the configurations of all the providers. https://docs.novu.co/channels-and-providers/integration-store

Available Operations

list

Return all the integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.integrations.list();

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { integrationsList } from "@novu/api/funcs/integrationsList.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await integrationsList(novu);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
idempotencyKey string A header for idempotency purposes
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.IntegrationsControllerListIntegrationsResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 400, 404, 409 application/json
errors.ValidationErrorDto 422 application/json
errors.SDKError 4XX, 5XX */*

create

Create an integration for the current environment the user is based on the API key provided

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.integrations.create({
    providerId: "<id>",
    channel: "sms",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { integrationsCreate } from "@novu/api/funcs/integrationsCreate.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await integrationsCreate(novu, {
    providerId: "<id>",
    channel: "sms",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
createIntegrationRequestDto components.CreateIntegrationRequestDto ✔️ N/A
idempotencyKey string A header for idempotency purposes
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.IntegrationsControllerCreateIntegrationResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 400, 404, 409 application/json
errors.ValidationErrorDto 422 application/json
errors.SDKError 4XX, 5XX */*

listActive

Return all the active integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.integrations.listActive();

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { integrationsListActive } from "@novu/api/funcs/integrationsListActive.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await integrationsListActive(novu);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
idempotencyKey string A header for idempotency purposes
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.IntegrationsControllerGetActiveIntegrationsResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 400, 404, 409 application/json
errors.ValidationErrorDto 422 application/json
errors.SDKError 4XX, 5XX */*

update

Update integration

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.integrations.update({}, "<id>");

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { integrationsUpdate } from "@novu/api/funcs/integrationsUpdate.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await integrationsUpdate(novu, {}, "<id>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
integrationId string ✔️ N/A
updateIntegrationRequestDto components.UpdateIntegrationRequestDto ✔️ N/A
idempotencyKey string A header for idempotency purposes
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.IntegrationsControllerUpdateIntegrationByIdResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 400, 409 application/json
errors.ValidationErrorDto 422 application/json
errors.SDKError 4XX, 5XX */*

delete

Delete integration

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.integrations.delete("<id>");

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { integrationsDelete } from "@novu/api/funcs/integrationsDelete.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await integrationsDelete(novu, "<id>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
integrationId string ✔️ N/A
idempotencyKey string A header for idempotency purposes
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.IntegrationsControllerRemoveIntegrationResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 400, 404, 409 application/json
errors.ValidationErrorDto 422 application/json
errors.SDKError 4XX, 5XX */*

setAsPrimary

Set integration as primary

Example Usage

import { Novu } from "@novu/api";

const novu = new Novu({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.integrations.setAsPrimary("<id>");

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { NovuCore } from "@novu/api/core.js";
import { integrationsSetAsPrimary } from "@novu/api/funcs/integrationsSetAsPrimary.js";

// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const res = await integrationsSetAsPrimary(novu, "<id>");

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

Parameters

Parameter Type Required Description
integrationId string ✔️ N/A
idempotencyKey string A header for idempotency purposes
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.IntegrationsControllerSetIntegrationAsPrimaryResponse>

Errors

Error Type Status Code Content Type
errors.ErrorDto 400, 409 application/json
errors.ValidationErrorDto 422 application/json
errors.SDKError 4XX, 5XX */*