type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* List Trigger Action and Condition Definitions
* Returns the definitions of the actions a trigger can perform and the
definitions of the conditions under which a trigger can execute. The
definition of the action includes a title ("Status"), a type ("list"), and
possible values. The definition of the condition includes the same fields
as well as the possible operators.
For a list of supported actions, see the Actions reference
For a list of supported conditions, see the Conditions reference
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/triggers/definitions`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 377 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* List Trigger Action and Condition Definitions
* Returns the definitions of the actions a trigger can perform and the
definitions of the conditions under which a trigger can execute. The
definition of the action includes a title ("Status"), a type ("list"), and
possible values. The definition of the condition includes the same fields
as well as the possible operators.
For a list of supported actions, see the Actions reference
For a list of supported conditions, see the Conditions reference
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/triggers/definitions`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 923 days ago