The Myndbend™ Process Manager action add-approvers-by-id is used to automatically add approvers to tickets using their Zendesk user ID (when certain conditions are met). For example, a staff member may fill out a Zendesk form requesting a new laptop. Based on the selections made in the form, the premium version of MPM can automatically add one or more approvers.
How do I use this action?
Create a Zendesk trigger with conditions that match the moment when you want to add in the approver.
Then set the action in MPM. For the action, select Notify Webhook - MPM Webhook. You will be presented the option to paste in the message that will be sent to our servers.
The message for this action is:
{
"action": "add-approvers-by-id",
"data": ...
}
Where can I find the IDs of the users I want to add?
Approvers can be either agents or end-users / customers. If you'd like your end-users to be approvers, you'll first need to read Enable end users to be approvers.
Once you've identified the approvers to add automatically, you'll need to add this tag to their profile and obtain their Zendesk IDs.
- Navigate to Zendesk Settings > People
- Search for the approver and click on the user's name.
- Copy the Zendesk ID from the URL. For example:
https://yourdomain.zendesk.com/agent/users/123456789/requested_tickets
How do I specify the IDs of users I want to add?
Action add-approvers-by-id has two options you can use.
Adding approvers using their ID's in an array of numbers:
{
"action": "add-approvers-by-id",
"data": {
"id": [123,321,4524]
}
}
Adding approvers using a comma-separated string:
{
"action": "add-approvers-by-id",
"data": {
"id": "123,321,4534"
}
}
Both of these options will do the same action: Add Users with the following IDs (e.g. "123","321","4534") as approvers.
How to add approvers from a custom field
Zendesk placeholders can be used in every trigger message body in order to pull data that will be sent to the webhook. That means, if you have custom fields that hold the data that you want to send, you can use them! The only thing you need to do is use a placeholder for the field that holds the ID (instead of specifying the IDs,):
{
"action": "add-approvers-by-id",
"data": {
"id": "{{ticket.ticket_field_<field ID number>}}"
}
}
This also means that you can reference fields on the assignee's or requester's profiles. For example, you can have a custom user field that will contain the requester's manager ID. Therefore, you could add the manager of the requester as an approver, each time the user submits the ticket:
{
"action": "add-approvers-by-id",
"data": {
"id": "{{ticket.requester.custom_fields.<key_name>}}"
}
}
Conditionally adding approvers based on the form data
You might need to add approvers conditionally, based on what data is present in the ticket form itself. There are two ways to do this:
- Define the conditions of your Zendesk trigger as such. This means that you will have one trigger for each of your possible combinations.
- Use Liquid Script
Liquid Script is a simple scripting language developed by Shopify, used through Zendesk. You can use the script in your tickets, macros, automations as well as trigger messages!
Using Liquid Script, you can write simple conditional statements such as:
{% if ticket.ticket_field_123 == 'laptop' %}
321,
{% endif %}
With this statement - if the value of our ticket.ticket_field_123 is a laptop the script will print 321 - Otherwise, it will be skipped completely.
This means we can write conditional statements (as well as more complex scripts) that will determine the final approval list that needs to be added, by including these scripts into our webhook message bodies, like so:
{
"action": "add-approvers-by-id",
"data": {
"id": "
{% if ticket.ticket_field_option_title_<FIELD_ID> == '<DESIRED_VALUE>' %}
<USER_ID>,
{% endif %}
{% if ticket.ticket_field_option_title_<FIELD_ID> == '<DESIRED_VALUE>' %}
<USER_ID>,
{% endif %}
"
}
}
The outlined script above is just an example. Be sure to replace field IDs, values, and user IDs with values you need.
In the above code block, you will notice trailing commas after the user ID. This is required if there will be more than one approver added to the string of approvers.
If you decide to use Liquid Script, be sure to read our quick Liquid guide, which covers some of the most common questions.