# Webhook (*webhook*) ## Overview Operations related to webhook api ### Available Operations * [getAll](#getall) - Retrieve a Webhook * [create](#create) - Create a webhook * [get](#get) - Retrieve a webhook * [update](#update) - Update a webhook * [delete](#delete) - Delete a webhook * [getLogs](#getlogs) - Retrieve webhook logs * [getLog](#getlog) - Retrieve a webhook log * [resendLog](#resendlog) - Resend a webhook ## getAll Retrieve a Webhook ### Example Usage ```typescript import { Livepeer } from "livepeer"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.getAll(); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookGetAll } from "livepeer/funcs/webhookGetAll.js"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookGetAll(livepeer); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.GetWebhooksResponse](../../models/operations/getwebhooksresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## create To create a new webhook, you need to make an API call with the events you want to listen for and the URL that will be called when those events occur. ### Example Usage ```typescript import { Livepeer } from "livepeer"; import { Events } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.create({ name: "test_webhook", projectId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", events: [ Events.StreamStarted, Events.StreamIdle, ], url: "https://my-service.com/webhook", sharedSecret: "my-secret", streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", }); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookCreate } from "livepeer/funcs/webhookCreate.js"; import { Events } from "livepeer/models/components"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookCreate(livepeer, { name: "test_webhook", projectId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", events: [ Events.StreamStarted, Events.StreamIdle, ], url: "https://my-service.com/webhook", sharedSecret: "my-secret", streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", }); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `request` | [components.WebhookInput](../../models/components/webhookinput.md) | :heavy_check_mark: | The request object to use for the request. | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.CreateWebhookResponse](../../models/operations/createwebhookresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## get Retrieve a webhook ### Example Usage ```typescript import { Livepeer } from "livepeer"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.get(""); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookGet } from "livepeer/funcs/webhookGet.js"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookGet(livepeer, ""); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | *string* | :heavy_check_mark: | N/A | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.GetWebhookResponse](../../models/operations/getwebhookresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## update Update a webhook ### Example Usage ```typescript import { Livepeer } from "livepeer"; import { Events } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.update({ name: "test_webhook", projectId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", events: [ Events.StreamStarted, Events.StreamIdle, ], url: "https://my-service.com/webhook", sharedSecret: "my-secret", streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", }, ""); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookUpdate } from "livepeer/funcs/webhookUpdate.js"; import { Events } from "livepeer/models/components"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookUpdate(livepeer, { name: "test_webhook", projectId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", events: [ Events.StreamStarted, Events.StreamIdle, ], url: "https://my-service.com/webhook", sharedSecret: "my-secret", streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", }, ""); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | *string* | :heavy_check_mark: | N/A | | `webhook` | [components.WebhookInput](../../models/components/webhookinput.md) | :heavy_check_mark: | N/A | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.UpdateWebhookResponse](../../models/operations/updatewebhookresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## delete Delete a webhook ### Example Usage ```typescript import { Livepeer } from "livepeer"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.delete(""); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookDelete } from "livepeer/funcs/webhookDelete.js"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookDelete(livepeer, ""); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | *string* | :heavy_check_mark: | N/A | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.DeleteWebhookResponse](../../models/operations/deletewebhookresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getLogs Retrieve webhook logs ### Example Usage ```typescript import { Livepeer } from "livepeer"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.getLogs(""); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookGetLogs } from "livepeer/funcs/webhookGetLogs.js"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookGetLogs(livepeer, ""); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | *string* | :heavy_check_mark: | N/A | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.GetWebhookLogsResponse](../../models/operations/getwebhooklogsresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## getLog Retrieve a webhook log ### Example Usage ```typescript import { Livepeer } from "livepeer"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.getLog("", ""); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookGetLog } from "livepeer/funcs/webhookGetLog.js"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookGetLog(livepeer, "", ""); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | *string* | :heavy_check_mark: | N/A | | `logId` | *string* | :heavy_check_mark: | N/A | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.GetWebhookLogResponse](../../models/operations/getwebhooklogresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* | ## resendLog Use this API to resend the same webhook request. This is useful when developing and debugging, allowing you to easily repeat the same webhook to check or fix the behaviour in your handler. ### Example Usage ```typescript import { Livepeer } from "livepeer"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { const result = await livepeer.webhook.resendLog("", ""); // Handle the result console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript import { LivepeerCore } from "livepeer/core.js"; import { webhookResendLog } from "livepeer/funcs/webhookResendLog.js"; // Use `LivepeerCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const livepeer = new LivepeerCore({ apiKey: "", }); async function run() { const res = await webhookResendLog(livepeer, "", ""); if (!res.ok) { throw res.error; } const { value: result } = res; // Handle the result console.log(result); } run(); ``` ### Parameters | Parameter | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | *string* | :heavy_check_mark: | N/A | | `logId` | *string* | :heavy_check_mark: | N/A | | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | 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](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[operations.ResendWebhookResponse](../../models/operations/resendwebhookresponse.md)\>** ### Errors | Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | | errors.SDKError | 4XX, 5XX | \*/\* |