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
↳
Automations
Table of contents
Constructors
Properties
Accessors
Methods
- _rawRequest
- bulkDelete
- create
- delete
- emit
- get
- getAll
- list
- listActive
- on
- patch
- post
- put
- reorder
- request
- requestAll
- requestUpload
- search
- setSideLoad
- show
- update
- updateMany
Constructors
constructor
• new Automations(options
): Automations
Parameters
Name | Type |
---|---|
options | any |
Returns
Overrides
Defined in
clients/core/automations.d.ts:10
Properties
_transporter
• _transporter: Transporter
Inherited from
Defined in
clients/client.d.ts:94
eventTarget
• eventTarget: CustomEventTarget
Event target to handle custom events.
Inherited from
Defined in
clients/client.d.ts:92
jsonAPINames
• jsonAPINames: string
[]
Array to hold names used in the JSON API.
Overrides
Defined in
clients/core/automations.d.ts:11
options
• options: ClientOptions
& { get
: (key
: string
) => any
}
Configuration options for the client.
Inherited from
Defined in
clients/client.d.ts:86
sideLoad
• sideLoad: any
[]
Array to handle side-loaded resources.
Inherited from
Defined in
clients/client.d.ts:89
useDotJson
• useDotJson: boolean
Flag to indicate if the API endpoint should use '.json' ending.
Inherited from
Defined in
clients/client.d.ts:91
Accessors
transporter
• get
transporter(): Transporter
Transporter for making requests.
Returns
Inherited from
Client.transporter
Defined in
clients/client.d.ts:93
Methods
_rawRequest
▸ _rawRequest(method
, uri
, ...args
): Promise
<{ response
: any
; result
: {} }>
Parameters
Name | Type |
---|---|
method | any |
uri | any |
...args | any [] |
Returns
Promise
<{ response
: any
; result
: {} }>
Inherited from
Defined in
clients/client.d.ts:130
bulkDelete
▸ bulkDelete(ids
): Promise
<void
>
Bulk delete automations.
Parameters
Name | Type | Description |
---|---|---|
ids | number [] | Array of automation IDs to be deleted. |
Returns
Promise
<void
>
Async
See
Example
await client.automations.bulkDelete([12345, 67890]);
Defined in
clients/core/automations.d.ts:93
create
▸ create(automationData
): Promise
<object
>
Create a new automation.
Parameters
Name | Type | Description |
---|---|---|
automationData | object | Data 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
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
Name | Type | Description |
---|---|---|
automationID | number | ID of the automation to be deleted. |
Returns
Promise
<void
>
Async
See
https://developer.zendesk.com/api-reference/ticketing/business-rules/automations/#delete-automation
Example
await client.automations.delete(12345);
Overrides
Defined in
clients/core/automations.d.ts:83
emit
▸ emit(eventType
, eventData
): void
Parameters
Name | Type |
---|---|
eventType | any |
eventData | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:95
get
▸ get(resource
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:114
getAll
▸ getAll(resource
): Promise
<any
[]>
Parameters
Name | Type |
---|---|
resource | any |
Returns
Promise
<any
[]>
Inherited from
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
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
Example
const activeAutomations = await client.automations.listActive();
Defined in
clients/core/automations.d.ts:27
on
▸ on(eventType
, callback
): void
Parameters
Name | Type |
---|---|
eventType | any |
callback | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:96
patch
▸ patch(...args
): Promise
<void
| object
>
Patches a resource.
Parameters
Name | Type | Description |
---|---|---|
...args | any [] | The resources or parts of the resource path followed by the body. |
Returns
Promise
<void
| object
>
- Either void or response object
Inherited from
Defined in
clients/client.d.ts:120
post
▸ post(resource
, body
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
body | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:122
put
▸ put(resource
, body
): Promise
<NodeModule
>
Parameters
Name | Type |
---|---|
resource | any |
body | any |
Returns
Promise
<NodeModule
>
Inherited from
Defined in
clients/client.d.ts:121
reorder
▸ reorder(automationIDs
): Promise
<object
>
Reorder the list of automations.
Parameters
Name | Type | Description |
---|---|---|
automationIDs | number [] | Array of automation IDs in the desired order. |
Returns
Promise
<object
>
Returns the status of the reorder.
Async
Example
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
Name | Type | Description |
---|---|---|
method | string | HTTP method (e.g., 'GET', 'POST'). |
uri | string | The URI for the request. |
...args | any [] | Additional arguments for the request. |
Returns
Promise
<NodeModule
>
- The API response.
Inherited from
Defined in
clients/client.d.ts:148
requestAll
▸ requestAll(method
, uri
, ...args
): Promise
<any
[]>
Parameters
Name | Type |
---|---|
method | any |
uri | any |
...args | any [] |
Returns
Promise
<any
[]>
Inherited from
Defined in
clients/client.d.ts:149
requestUpload
▸ requestUpload(uri
, file
): Promise
<any
>
Parameters
Name | Type |
---|---|
uri | any |
file | any |
Returns
Promise
<any
>
Inherited from
Defined in
clients/client.d.ts:150
search
▸ search(searchQuery
): Promise
<any
[]>
Search automations by with query.
Parameters
Name | Type | Description |
---|---|---|
searchQuery | object | The 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
const foundAutomations = await client.automations.search('close');
Defined in
clients/core/automations.d.ts:102
setSideLoad
▸ setSideLoad(array
): void
Parameters
Name | Type |
---|---|
array | any |
Returns
void
Inherited from
Defined in
clients/client.d.ts:113
show
▸ show(automationID
): Promise
<object
>
Get details of a specific automation by ID.
Parameters
Name | Type | Description |
---|---|---|
automationID | number | The 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
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
Name | Type | Description |
---|---|---|
automationID | number | ID of the automation to update. |
updatedData | object | Updated 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
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
Name | Type | Description |
---|---|---|
automations | object [] | Array of automation data with their IDs to be updated. |
Returns
Promise
<object
>
Returns the status of the bulk update.
Async
See
Example
const status = await client.automations.updateMany([{id: 123, position: 1}, {id: 124, position: 2}]);
Defined in
clients/core/automations.d.ts:73