Skip to content

Latest commit

 

History

History
170 lines (126 loc) · 12.7 KB

File metadata and controls

170 lines (126 loc) · 12.7 KB

Webhooks

Overview

Operations related to Webhooks

Available Operations

  • get - Retrieve a webhook
  • retry - Retry a webhook

get

Retrieve detailed information for a specific webhook by its unique identifier including delivery attempts and response data. Returns webhook details with topic, account information, delivery attempts containing request/response history, and links to subscription and retry resources. Essential for debugging webhook delivery issues, analyzing response data, and monitoring notification processing status.

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.webhooks.get({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { webhooksGet } from "dwolla/funcs/webhooksGet.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 webhooksGet(dwolla, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webhooksGet failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetWebhookRequest ✔️ 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.Webhook>

Errors

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

retry

Retry a webhook by its unique identifier to redeliver the notification to your endpoint. Creates a new retry attempt and returns the location of the new webhook resource. Essential for recovering from webhook delivery failures and ensuring reliable event notification processing in your application.

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.webhooks.retry({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { DwollaCore } from "dwolla/core.js";
import { webhooksRetry } from "dwolla/funcs/webhooksRetry.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 webhooksRetry(dwolla, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("webhooksRetry failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.RetryWebhookRequest ✔️ 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.RetryWebhookResponse>

Errors

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