Macros are predefined ticket field and ticket comment values which can be applied to a ticket for sending consistent responses to ticket requesters. Currently macros can only be listed and applied to tickets via the API.
List all
GET /macros.xml
Returns an ordered list of available macros. Response consists of macro records with ID, title and availability type (everyone, group or personal).
Status: 200
<macros>
<macro>
<id type="integer">110</id>
<title>Mark as Incident</title>
<availability-type>everyone</availability-type>
</macro>
<macro>
<id type="integer">106</id>
<title>Assign</title>
<availability-type>personal</availability-type>
</macro>
<macro>
<id type="integer">68</id>
<title>Close and redirect to topics</title>
<availability-type>personal</availability-type>
</macro>
</macros>
Nested macros
For Zendesk accounts which use many macros, Zendesk allows administrators to nest macros for easier categorization and access by support agents. Nesting of macros is represented by the presence of a delimiter (the string “::”) in the macro name. API clients are expected to use this delimiter to display available macros in a hierarchical fashion.
For example, if there are three macros named “Respond::SLA Platinum”, “Respond::SLA Gold”, “Respond::SLA Silver” in the API response, it means that there is a top level group of macros named “Respond”, which contains the actual macros, called “SLA Platinum”, “SLA Gold” and “SLA Silver”.
This nesting can be multiple levels deep. Using the above example, another macro named “Respond::SLA Platinum::Billing” which implies a three-level hierarchy.
Evaluate
POST /macros/#{macro-id}/apply.xml?ticket_id=#{ticket-id}
Apply a macro to a ticket by ID, specified in the ticket_id query parameter. For applying a macro to a new ticket, use ticket_id=0.
The response will contain a collection of key value pairs corresponding to ticket attributes. The format of these key value pairs follows the request formats used in the Ticket API. API clients should apply these attributes to the ticket ‘form’ being displayed to the user.
Response
Status: 200
<ticket>
<comment>
<value>Foo</value>
<is-public>false</is-public>
</comment>
<current-tags>foobar2</current-tags>
<ticket-type-id>2</ticket-type-id>
<group-id>4</group-id>
<assignee-id>4</assignee-id>
</ticket>