update_automation
Update Zendesk automations by modifying title, description, conditions, and actions. Streamline workflows by customizing rules and responses directly through the API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | No | Updated actions | |
| conditions | No | Updated conditions | |
| description | No | Updated automation description | |
| id | Yes | Automation ID to update | |
| title | No | Updated automation title |
Implementation Reference
- src/tools/automations.js:124-146 (handler)Handler function for the 'update_automation' tool. It constructs the update data from input parameters, calls zendeskClient.updateAutomation, and returns a formatted success or error response.handler: async ({ id, title, description, conditions, actions }) => { try { const automationData = {}; if (title !== undefined) automationData.title = title; if (description !== undefined) automationData.description = description; if (conditions !== undefined) automationData.conditions = conditions; if (actions !== undefined) automationData.actions = actions; const result = await zendeskClient.updateAutomation(id, automationData); return { content: [{ type: "text", text: `Automation updated successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error updating automation: ${error.message}` }], isError: true }; } }
- src/tools/automations.js:103-123 (schema)Input schema using Zod for validating parameters of the update_automation tool: required id, optional title, description, conditions, actions.schema: { id: z.number().describe("Automation ID to update"), title: z.string().optional().describe("Updated automation title"), description: z.string().optional().describe("Updated automation description"), conditions: z.object({ all: z.array(z.object({ field: z.string().describe("Field to check"), operator: z.string().describe("Operator for comparison"), value: z.any().describe("Value to compare against") })).optional(), any: z.array(z.object({ field: z.string().describe("Field to check"), operator: z.string().describe("Operator for comparison"), value: z.any().describe("Value to compare against") })).optional() }).optional().describe("Updated conditions"), actions: z.array(z.object({ field: z.string().describe("Field to modify"), value: z.any().describe("Value to set") })).optional().describe("Updated actions") },
- src/server.js:31-52 (registration)Registration of all tools, including update_automation from automationsTools, by spreading tool arrays and registering each with server.tool().const allTools = [ ...ticketsTools, ...usersTools, ...organizationsTools, ...groupsTools, ...macrosTools, ...viewsTools, ...triggersTools, ...automationsTools, ...searchTools, ...helpCenterTools, ...supportTools, ...talkTools, ...chatTools, ]; // Register each tool with the server allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:241-243 (helper)Helper method in ZendeskClient that sends the PUT request to the Zendesk API to update an automation.async updateAutomation(id, data) { return this.request("PUT", `/automations/${id}.json`, { automation: data }); }
- src/server.js:16-16 (registration)Import of automationsTools array containing the update_automation tool definition.import { automationsTools } from "./tools/automations.js";