create_automation
Generate automated workflows in Zendesk by defining conditions and actions to streamline ticket management and improve efficiency.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| actions | Yes | Actions to perform when automation conditions are met | |
| conditions | Yes | Conditions for the automation | |
| description | No | Automation description | |
| title | Yes | Automation title |
Implementation Reference
- src/tools/automations.js:76-98 (handler)The handler function for the 'create_automation' tool. It prepares the automation data from input parameters and delegates the API call 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 defining the input parameters for the 'create_automation' tool, including title, optional description, conditions (all/any), and actions.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/server.js:47-52 (registration)Registration of all tools, including 'create_automation' from automationsTools, using server.tool() in a loop over the combined tools array. automationsTools imported at line 16 and spread into allTools at line 39.// Register each tool with the server allTools.forEach((tool) => { server.tool(tool.name, tool.schema, tool.handler, { description: tool.description, }); });
- src/zendesk-client.js:237-239 (helper)ZendeskClient helper method that performs the actual POST request to the Zendesk API to create an automation, called by the tool handler.async createAutomation(data) { return this.request("POST", "/automations.json", { automation: data }); }