Skip to content

node-zendesk / Exports / clients/core/automations / Automations

Class: Automations

clients/core/automations.Automations

The Automations class provides methods for interacting with the Zendesk Automation API. See the Zendesk API documentation for more details.

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Automations(options): Automations

Parameters

NameType
optionsany

Returns

Automations

Overrides

Client.constructor

Defined in

clients/core/automations.d.ts:10

Properties

_transporter

_transporter: Transporter

Inherited from

Client._transporter

Defined in

clients/client.d.ts:94


eventTarget

eventTarget: CustomEventTarget

Event target to handle custom events.

Inherited from

Client.eventTarget

Defined in

clients/client.d.ts:92


jsonAPINames

jsonAPINames: string[]

Array to hold names used in the JSON API.

Overrides

Client.jsonAPINames

Defined in

clients/core/automations.d.ts:11


options

options: ClientOptions & { get: (key: string) => any }

Configuration options for the client.

Inherited from

Client.options

Defined in

clients/client.d.ts:86


sideLoad

sideLoad: any[]

Array to handle side-loaded resources.

Inherited from

Client.sideLoad

Defined in

clients/client.d.ts:89


useDotJson

useDotJson: boolean

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

Inherited from

Client.useDotJson

Defined in

clients/client.d.ts:91

Accessors

transporter

get transporter(): Transporter

Transporter for making requests.

Returns

Transporter

Inherited from

Client.transporter

Defined in

clients/client.d.ts:93

Methods

_rawRequest

_rawRequest(method, uri, ...args): Promise<{ response: any ; result: {} }>

Parameters

NameType
methodany
uriany
...argsany[]

Returns

Promise<{ response: any ; result: {} }>

Inherited from

Client._rawRequest

Defined in

clients/client.d.ts:130


bulkDelete

bulkDelete(ids): Promise<void>

Bulk delete automations.

Parameters

NameTypeDescription
idsnumber[]Array of automation IDs to be deleted.

Returns

Promise<void>

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#bulk-delete-automation

Example

ts
await client.automations.bulkDelete([12345, 67890]);

Defined in

clients/core/automations.d.ts:93


create

create(automationData): Promise<object>

Create a new automation.

Parameters

NameTypeDescription
automationDataobjectData for the new automation.

Returns

Promise<object>

Returns the created automation.

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#create-automation

Example

ts
const automation = await client.automations.create({
  title: "Roger Wilco",
  conditions: { ... },
  actions: { ... }
});

Defined in

clients/core/automations.d.ts:50


delete

delete(automationID): Promise<void>

Delete an automation.

Parameters

NameTypeDescription
automationIDnumberID of the automation to be deleted.

Returns

Promise<void>

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#delete-automation

Example

ts
await client.automations.delete(12345);

Overrides

Client.delete

Defined in

clients/core/automations.d.ts:83


emit

emit(eventType, eventData): void

Parameters

NameType
eventTypeany
eventDataany

Returns

void

Inherited from

Client.emit

Defined in

clients/client.d.ts:95


get

get(resource): Promise<NodeModule>

Parameters

NameType
resourceany

Returns

Promise<NodeModule>

Inherited from

Client.get

Defined in

clients/client.d.ts:114


getAll

getAll(resource): Promise<any[]>

Parameters

NameType
resourceany

Returns

Promise<any[]>

Inherited from

Client.getAll

Defined in

clients/client.d.ts:129


list

list(): Promise<any[]>

List all automations.

Returns

Promise<any[]>

Returns a list of automations.

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#list-automations

Example

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

Defined in

clients/core/automations.d.ts:19


listActive

listActive(): Promise<any[]>

List all active automations.

Returns

Promise<any[]>

Returns a list of active automations.

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#list-active-automations

Example

ts
const activeAutomations = await client.automations.listActive();

Defined in

clients/core/automations.d.ts:27


on

on(eventType, callback): void

Parameters

NameType
eventTypeany
callbackany

Returns

void

Inherited from

Client.on

Defined in

clients/client.d.ts:96


patch

patch(...args): Promise<void | object>

Patches a resource.

Parameters

NameTypeDescription
...argsany[]The resources or parts of the resource path followed by the body.

Returns

Promise<void | object>

  • Either void or response object

Inherited from

Client.patch

Defined in

clients/client.d.ts:120


post

post(resource, body): Promise<NodeModule>

Parameters

NameType
resourceany
bodyany

Returns

Promise<NodeModule>

Inherited from

Client.post

Defined in

clients/client.d.ts:122


put

put(resource, body): Promise<NodeModule>

Parameters

NameType
resourceany
bodyany

Returns

Promise<NodeModule>

Inherited from

Client.put

Defined in

clients/client.d.ts:121


reorder

reorder(automationIDs): Promise<object>

Reorder the list of automations.

Parameters

NameTypeDescription
automationIDsnumber[]Array of automation IDs in the desired order.

Returns

Promise<object>

Returns the status of the reorder.

Async

Example

ts
const status = await client.automations.reorder([67890, 12345]);

Deprecated

This may now be deprecated, please notify developers if you find this to be the case.

Defined in

clients/core/automations.d.ts:112


request

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

Request method that handles various HTTP methods.

Type parameters

Name
T

Parameters

NameTypeDescription
methodstringHTTP method (e.g., 'GET', 'POST').
uristringThe URI for the request.
...argsany[]Additional arguments for the request.

Returns

Promise<NodeModule>

  • The API response.

Inherited from

Client.request

Defined in

clients/client.d.ts:148


requestAll

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

Parameters

NameType
methodany
uriany
...argsany[]

Returns

Promise<any[]>

Inherited from

Client.requestAll

Defined in

clients/client.d.ts:149


requestUpload

requestUpload(uri, file): Promise<any>

Parameters

NameType
uriany
fileany

Returns

Promise<any>

Inherited from

Client.requestUpload

Defined in

clients/client.d.ts:150


search(searchQuery): Promise<any[]>

Search automations by with query.

Parameters

NameTypeDescription
searchQueryobjectThe parameters to search for ['active', 'include', 'query', 'sort_by', 'sort_order'].

Returns

Promise<any[]>

Returns automations matching the search query.

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#search-automation

Example

ts
const foundAutomations = await client.automations.search('close');

Defined in

clients/core/automations.d.ts:102


setSideLoad

setSideLoad(array): void

Parameters

NameType
arrayany

Returns

void

Inherited from

Client.setSideLoad

Defined in

clients/client.d.ts:113


show

show(automationID): Promise<object>

Get details of a specific automation by ID.

Parameters

NameTypeDescription
automationIDnumberThe ID of the automation.

Returns

Promise<object>

Returns details of the automation.

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#show-automation

Example

ts
const automationDetails = await client.automations.show(123456);

Defined in

clients/core/automations.d.ts:36


update

update(automationID, updatedData): Promise<object>

Update an existing automation.

Parameters

NameTypeDescription
automationIDnumberID of the automation to update.
updatedDataobjectUpdated data for the automation.

Returns

Promise<object>

Returns the updated automation.

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#update-automation

Example

ts
const updatedAutomation = await client.automations.update(12345, {
  title: "Updated Automation"
});

Defined in

clients/core/automations.d.ts:63


updateMany

updateMany(automations): Promise<object>

Update many automations in bulk.

Parameters

NameTypeDescription
automationsobject[]Array of automation data with their IDs to be updated.

Returns

Promise<object>

Returns the status of the bulk update.

Async

See

https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#update-many-automation

Example

ts
const status = await client.automations.updateMany([{id: 123, position: 1}, {id: 124, position: 2}]);

Defined in

clients/core/automations.d.ts:73

Released under the MIT License.