Skip to content

node-zendeskDocs


node-zendesk / clients/core/webhooks / Webhooks

Class: Webhooks

Webhooks client for interacting with the Zendesk Webhooks API.

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/

Extends

Constructors

new Webhooks()

new Webhooks(options): Webhooks

Parameters

options: any

Returns

Webhooks

Overrides

Client.constructor

Defined in

clients/core/webhooks.d.ts:6

Properties

_transporter

_transporter: Transporter

Inherited from

Client._transporter

Defined in

clients/client.d.ts:42


eventTarget

eventTarget: CustomEventTarget

Event target to handle custom events.

Inherited from

Client.eventTarget

Defined in

clients/client.d.ts:40


jsonAPINames

jsonAPINames: string[]

Array to hold names used in the JSON API.

Overrides

Client.jsonAPINames

Defined in

clients/core/webhooks.d.ts:7


options

options: ZendeskClientOptions & object

Configuration options for the client.

Type declaration

get()

get: (key) => any

Parameters

key: string

Returns

any

Inherited from

Client.options

Defined in

clients/client.d.ts:34


sideLoad

sideLoad: any[]

Array to handle side-loaded resources.

Inherited from

Client.sideLoad

Defined in

clients/client.d.ts:37


useDotJson

useDotJson: boolean

Flag to indicate if the API endpoint should use '.json' ending.

Inherited from

Client.useDotJson

Defined in

clients/client.d.ts:39

Accessors

transporter

Get Signature

get transporter(): Transporter

Returns

Transporter

Transporter for making requests.

Inherited from

Client.transporter

Defined in

clients/client.d.ts:41

Methods

_rawRequest()

_rawRequest(method, uri, ...arguments_): Promise<object>

Parameters

method: any

uri: any

• ...arguments_: any[]

Returns

Promise<object>

response

response: any

result

result: object

Inherited from

Client._rawRequest

Defined in

clients/client.d.ts:78


create()

create(webhook): Promise<object>

Create a new webhook.

Parameters

webhook: object

The webhook data to create.

Returns

Promise<object>

A promise that resolves to the created webhook.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#create-or-clone-webhook

Example

ts
const newWebhook = {
  // ... webhook data ...
};
const createdWebhook = await client.webhooks.create(newWebhook);

Defined in

clients/core/webhooks.d.ts:37


delete()

delete(webhookID): Promise<object>

Delete a specific webhook by ID.

Parameters

webhookID: string

The ID of the webhook to delete.

Returns

Promise<object>

A promise that resolves when the webhook is deleted.

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#delete-webhook

Example

ts
await client.webhooks.delete('webhookID123');

Overrides

Client.delete

Defined in

clients/core/webhooks.d.ts:64


emit()

emit(eventType, eventData): void

Parameters

eventType: any

eventData: any

Returns

void

Inherited from

Client.emit

Defined in

clients/client.d.ts:43


get()

get(resource): Promise<NodeModule>

Parameters

resource: any

Returns

Promise<NodeModule>

Inherited from

Client.get

Defined in

clients/client.d.ts:62


getAll()

getAll(resource): Promise<any[]>

Parameters

resource: any

Returns

Promise<any[]>

Inherited from

Client.getAll

Defined in

clients/client.d.ts:77


getSigningSecret()

getSigningSecret(webhookID): Promise<object>

Retrieve the signing secret of a specific webhook.

Parameters

webhookID: string

The ID of the webhook.

Returns

Promise<object>

A promise that resolves to the signing secret.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#show-webhook-signing-secret

Example

ts
const secret = await client.webhooks.getSigningSecret('webhookID123');

Defined in

clients/core/webhooks.d.ts:111


list()

list(): Promise<object>

List all webhooks.

Returns

Promise<object>

A promise that resolves to the list of webhooks.

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhooks

Example

ts
const webhooks = await client.webhooks.list();

Defined in

clients/core/webhooks.d.ts:14


listInvocationAttempts()

listInvocationAttempts(webhookID, invocationID): Promise<object>

List invocation attempts for a specific webhook.

Parameters

webhookID: string

The ID of the webhook.

invocationID: string

The ID of the webhook invocation.

Returns

Promise<object>

A promise that resolves to the list of invocation attempts.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhook-invocation-attempts

Example

ts
const attempts = await client.webhooks.listInvocationAttempts('webhookID123', 'invocationID123');

Defined in

clients/core/webhooks.d.ts:100


listInvocations()

listInvocations(webhookID): Promise<object>

List invocations for a specific webhook.

Parameters

webhookID: string

The ID of the webhook.

Returns

Promise<object>

A promise that resolves to the list of invocations.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#list-webhook-invocations

Example

ts
const invocations = await client.webhooks.listInvocations('webhookID123');

Defined in

clients/core/webhooks.d.ts:88


on()

on(eventType, callback): void

Parameters

eventType: any

callback: any

Returns

void

Inherited from

Client.on

Defined in

clients/client.d.ts:44


patch()

patch(webhookID, webhook): Promise<object>

Patch a specific webhook by ID.

Parameters

webhookID: string

The ID of the webhook to patch.

webhook: object

The data to patch.

Returns

Promise<object>

A promise that resolves to the patched webhook.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#patch-webhook

Example

ts
const patchData = {
  // ... patch data ...
};
const patchedWebhook = await client.webhooks.patch('webhookID123', patchData);

Overrides

Client.patch

Defined in

clients/core/webhooks.d.ts:138


post()

post(resource, body): Promise<NodeModule>

Parameters

resource: any

body: any

Returns

Promise<NodeModule>

Inherited from

Client.post

Defined in

clients/client.d.ts:70


put()

put(resource, body): Promise<NodeModule>

Parameters

resource: any

body: any

Returns

Promise<NodeModule>

Inherited from

Client.put

Defined in

clients/client.d.ts:69


request()

request<T>(method, uri, ...arguments_): Promise<NodeModule>

Request method that handles various HTTP methods.

Type Parameters

T

Parameters

method: string

HTTP method (e.g., 'GET', 'POST').

uri: string

The URI for the request.

• ...arguments_: any[]

Additional arguments for the request.

Returns

Promise<NodeModule>

  • The API response.

Inherited from

Client.request

Defined in

clients/client.d.ts:96


requestAll()

requestAll(method, uri, ...arguments_): Promise<any[]>

Parameters

method: any

uri: any

• ...arguments_: any[]

Returns

Promise<any[]>

Inherited from

Client.requestAll

Defined in

clients/client.d.ts:97


requestUpload()

requestUpload(uri, file): Promise<any>

Parameters

uri: any

file: any

Returns

Promise<any>

Inherited from

Client.requestUpload

Defined in

clients/client.d.ts:98


resetSigningSecret()

resetSigningSecret(webhookID): Promise<object>

Reset the signing secret for a specific webhook.

Parameters

webhookID: string

The ID of the webhook.

Returns

Promise<object>

A promise that resolves to the new signing secret.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#reset-webhook-signing-secret

Example

ts
const newSecret = await client.webhooks.resetSigningSecret('webhookID123');

Defined in

clients/core/webhooks.d.ts:122


setSideLoad()

setSideLoad(array): void

Parameters

array: any

Returns

void

Inherited from

Client.setSideLoad

Defined in

clients/client.d.ts:61


show()

show(webhookID): Promise<object>

Retrieve a specific webhook by ID.

Parameters

webhookID: string

The ID of the webhook to retrieve.

Returns

Promise<object>

A promise that resolves to the specified webhook.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#show-webhook

Example

ts
const webhook = await client.webhooks.show('webhookID123');

Defined in

clients/core/webhooks.d.ts:22


test()

test(request, webhookID?): Promise<object>

Test a new or existing webhook.

Parameters

request: object

The request data for testing the webhook.

webhookID?: string

The ID of the webhook to be tested (for existing webhooks).

Returns

Promise<object>

A promise that resolves to the test result.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#test-webhook

Example

ts
const requestData = {
  // ... request data ...
};
const testResult = await client.webhooks.test(requestData, 'webhookID123');

Defined in

clients/core/webhooks.d.ts:77


update()

update(webhookID, webhook): Promise<object>

Update a specific webhook by ID.

Parameters

webhookID: string

The ID of the webhook to update.

webhook: object

The updated webhook data.

Returns

Promise<object>

A promise that resolves to the updated webhook.

response

response: object

result

result: object

See

https://developer.zendesk.com/api-reference/webhooks/webhooks-api/webhooks/#update-webhook

Example

ts
const updatedData = {
  // ... updated data ...
};
const updatedWebhook = await client.webhooks.update('webhookID123', updatedData);

Defined in

clients/core/webhooks.d.ts:53

Released under the MIT License.