create_automation
Create automated workflows in Zendesk by defining conditions and actions to manage tickets and improve support processes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Automation title | |
| description | No | Automation description | |
| conditions | Yes | Conditions for the automation | |
| actions | Yes | Actions to perform when automation conditions are met |
Implementation Reference
- src/tools/automations.js:76-98 (handler)The main handler function for the 'create_automation' tool. It constructs the automation data from input parameters and delegates to zendeskClient.createAutomation(), handling success and error responses.handler: async ({ title, description, conditions, actions }) => { try { const automationData = { title, description, conditions, actions }; const result = await zendeskClient.createAutomation(automationData); return { content: [{ type: "text", text: `Automation created successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating automation: ${error.message}` }], isError: true }; } }
- src/tools/automations.js:56-75 (schema)Zod schema for input validation of the 'create_automation' tool, defining required title, optional description, complex conditions object, and actions array.schema: { title: z.string().describe("Automation title"), description: z.string().optional().describe("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() }).describe("Conditions for the automation"), actions: z.array(z.object({ field: z.string().describe("Field to modify"), value: z.any().describe("Value to set") })).describe("Actions to perform when automation conditions are met") },
- src/tools/automations.js:53-98 (registration)The complete tool definition object for 'create_automation', including name, description, schema, and handler. This object is part of the exported automationsTools array, which is imported and registered in src/server.js.{ name: "create_automation", description: "Create a new automation", schema: { title: z.string().describe("Automation title"), description: z.string().optional().describe("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() }).describe("Conditions for the automation"), actions: z.array(z.object({ field: z.string().describe("Field to modify"), value: z.any().describe("Value to set") })).describe("Actions to perform when automation conditions are met") }, handler: async ({ title, description, conditions, actions }) => { try { const automationData = { title, description, conditions, actions }; const result = await zendeskClient.createAutomation(automationData); return { content: [{ type: "text", text: `Automation created successfully!\n\n${JSON.stringify(result, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating automation: ${error.message}` }], isError: true }; } }
- src/zendesk-client.js:237-239 (helper)ZendeskClient helper method invoked by the tool handler to perform the actual API POST request to create an automation.async createAutomation(data) { return this.request("POST", "/automations.json", { automation: data }); }
- src/server.js:48-52 (registration)The registration loop in the main server file that registers all tools, including 'create_automation' from automationsTools, by calling server.tool() for each.allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });