Skip to content

Latest commit

 

History

History
420 lines (317 loc) · 32.2 KB

File metadata and controls

420 lines (317 loc) · 32.2 KB

WebhookSubscriptions

Overview

Available Operations

  • list - List webhook subscriptions
  • create - Create a webhook subscription
  • get - Retrieve a webhook subscription
  • update - Update a webhook subscription
  • delete - Delete a webhook subscription

list

Retrieve all webhook subscriptions that belong to an application including their configuration details and status. Returns subscription details including webhook endpoints, status, creation dates, and links to associated webhooks with total count. Essential for webhook management and monitoring subscription health.

Example Usage

import { Dwolla } from "dwolla";

const dwolla = new Dwolla({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const result = await dwolla.webhookSubscriptions.list();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { webhookSubscriptionsList } from "dwolla/funcs/webhookSubscriptionsList.js";

// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const res = await webhookSubscriptionsList(dwolla);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webhookSubscriptionsList failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
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.ListWebhookSubscriptionsResponse>

Errors

Error Type Status Code Content Type
errors.ForbiddenError 403 application/vnd.dwolla.v1.hal+json
errors.NotFoundError 404 application/vnd.dwolla.v1.hal+json
errors.APIError 4XX, 5XX */*

create

Create a webhook subscription to deliver webhook notifications to a specified URL endpoint for your application. Requires a destination URL where Dwolla will send notifications and a secret key for webhook validation and security. Returns the location of the created subscription resource. Essential for establishing real-time event notifications and automated integrations with Dwolla's payment processing events.

Example Usage

import { Dwolla } from "dwolla";

const dwolla = new Dwolla({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const result = await dwolla.webhookSubscriptions.create({
    url: "http://myapplication.com/webhooks",
    secret: "sshhhhhh",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { webhookSubscriptionsCreate } from "dwolla/funcs/webhookSubscriptionsCreate.js";

// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const res = await webhookSubscriptionsCreate(dwolla, {
    url: "http://myapplication.com/webhooks",
    secret: "sshhhhhh",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webhookSubscriptionsCreate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CreateWebhookSubscriptionRequest ✔️ The request object to use for the request.
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.CreateWebhookSubscriptionResponse>

Errors

Error Type Status Code Content Type
errors.InvalidUrlFormatError 400 application/vnd.dwolla.v1.hal+json
errors.SecretTooLongError 400 application/vnd.dwolla.v1.hal+json
errors.MaxSubscriptionsReachedError 400 application/vnd.dwolla.v1.hal+json
errors.ForbiddenError 403 application/vnd.dwolla.v1.hal+json
errors.NotFoundError 404 application/vnd.dwolla.v1.hal+json
errors.APIError 4XX, 5XX */*

get

Retrieve detailed information for a specific webhook subscription by its unique identifier. Returns subscription configuration including URL endpoint, creation date, and links to associated webhooks for comprehensive subscription management. Essential for monitoring webhook subscription status and accessing webhook delivery history.

Example Usage

import { Dwolla } from "dwolla";

const dwolla = new Dwolla({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const result = await dwolla.webhookSubscriptions.get({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { webhookSubscriptionsGet } from "dwolla/funcs/webhookSubscriptionsGet.js";

// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const res = await webhookSubscriptionsGet(dwolla, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webhookSubscriptionsGet failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetWebhookSubscriptionRequest ✔️ The request object to use for the request.
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<models.WebhookSubscription>

Errors

Error Type Status Code Content Type
errors.NotFoundError 404 application/vnd.dwolla.v1.hal+json
errors.APIError 4XX, 5XX */*

update

Update a webhook subscription to pause or resume webhook delivery notifications. Allows toggling the paused status to temporarily stop webhook notifications without deleting the subscription. Returns the updated subscription resource with the new paused status. Use this endpoint to manage webhook delivery during maintenance or troubleshooting periods.

Example Usage

import { Dwolla } from "dwolla";

const dwolla = new Dwolla({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const result = await dwolla.webhookSubscriptions.update({
    id: "<id>",
    requestBody: {
      paused: true,
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { webhookSubscriptionsUpdate } from "dwolla/funcs/webhookSubscriptionsUpdate.js";

// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const res = await webhookSubscriptionsUpdate(dwolla, {
    id: "<id>",
    requestBody: {
      paused: true,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webhookSubscriptionsUpdate failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpdateWebhookSubscriptionRequest ✔️ The request object to use for the request.
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<models.WebhookSubscription>

Errors

Error Type Status Code Content Type
errors.BadRequestError 400 application/vnd.dwolla.v1.hal+json
errors.NotFoundError 404 application/vnd.dwolla.v1.hal+json
errors.APIError 4XX, 5XX */*

delete

Delete a webhook subscription to permanently remove webhook notifications for your application. This action stops all future webhook deliveries and cannot be undone. Returns the deleted subscription resource for confirmation. Use this endpoint when webhook notifications are no longer needed or when cleaning up unused subscriptions.

Example Usage

import { Dwolla } from "dwolla";

const dwolla = new Dwolla({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const result = await dwolla.webhookSubscriptions.delete({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { webhookSubscriptionsDelete } from "dwolla/funcs/webhookSubscriptionsDelete.js";

// Use `DwollaCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const dwolla = new DwollaCore({
  security: {
    clientID: process.env["DWOLLA_CLIENT_ID"] ?? "",
    clientSecret: process.env["DWOLLA_CLIENT_SECRET"] ?? "",
  },
});

async function run() {
  const res = await webhookSubscriptionsDelete(dwolla, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webhookSubscriptionsDelete failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteRequest ✔️ The request object to use for the request.
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<models.WebhookSubscription>

Errors

Error Type Status Code Content Type
errors.NotFoundError 404 application/vnd.dwolla.v1.hal+json
errors.APIError 4XX, 5XX */*