This article describes how to automatically change the Requester (and relating Organization) using Zendesk Triggers which act on information in the Zendesk ticket's subject line.
This process is deprecated. It is highly recommended to use Private Ticket Creation to automatically set the ticket requester using a Reference Email.
Overview
The default Watchman Monitoring Zendesk integration creates tickets in the name of our internal user with the email address of "notifications@monitoringclient.com". Our setup documentation describes putting these tickets in a dedicated Zendesk Organziaton for triage.
Zendesk offers an extensive system of Targets, Extensions, and Triggers which allow for programatic action on tickets. In this article we are going to create a Zendesk Extension Target. We will instruct the Extension Target to change the ticket requester via a Zendesk Trigger. Finally, we will add a Trigger which looks for the Watchman Monitoring Group name in the subject line and uses the Zendesk Extension Target to change the Requestor to a specific user for that Group.
Generate an API Token
Click on the Admin icon or sprocket in the lower left corner.
Select Channels > API
Verify that Token Access is Enabled.
Click on the add new token link on the far right side of the Active API Token(s) header.
Provide a label for the API Token, such as "Change Requester" and click Create.
Copy the new API token.
Be sure to copy this API token, as it will not be displayed again and you will need to generate a new API token, if lost.
Create Extension Target
Only one Extension Target is required. Multiple Triggers may call this single Extension Target.
Click on the Admin icon or sprocket in the lower left corner.
Select Settings > Extensions.
Click the add target link on the right side of the target listing.
Select the HTTP target >>
Give the HTTP target a Title such as "Change Requester"
The URL for the target will be
https://ZENDESKSUBDOMAIN.zendesk.com/api/v2/tickets/{{ticket.id}}.json
For testing, use an actual ticket number
https://ZENDESKSUBDOMAIN.zendesk.com/api/v2/tickets/TICKETNUMBER.json
Change the Method to PUT which will expose the Content Type.
Change the Content Type to JSON.
Enable Basic Authentication
Enter the Authentication credentials.
For the Username use the account email followed by /token
e.g. robin@ourremotesupport.com/token
The Password is the API Token created above.
Your HTTP target should look similar to the following...
Testing the Extension Target (Optional)
For testing, use an actual ticket number for the URL instead of {{ticket.id}}
https://ZENDESKSUBDOMAIN.zendesk.com/api/v2/tickets/TICKETNUMBER.json
From the drop-down select Test Target, and then click Submit
In the JSON body: field enter the following JSON:
{"ticket": {"requester": {"name": "Customer", "email": "EMAILADDRESS"}}}
Replace EMAILADDRESS
with a valid email address.
And, click Submit.
This JSON command changes the requester by looking up the email address. The Customer name is not important, but the email address must be a user in your Zendesk.
If the JSON is successful, you will receive a HTTP/1.1 200 OK and will look similar to this:
Clicking on the Response tab, at the top of the response, you should see the requester has changed.
With a successful test, select Create target and click Submit.
Create a Trigger
Click on the Admin icon or sprocket in the lower left corner.
Select Business Rules > Triggers.
Add an action to your trigger by clicking the + button.
From the - Click to select action. - menu.
Select the Notifications: Notify target action.
In the secondary menu, select the Change Requester target.
In the JSON body: field enter the following JSON:
{"ticket": {"requester": {"name": "Customer", "email": "EMAILADDRESS"}}}
Your action should look like the following:
This JSON command changes the requester by looking up the email address. The Customer name is not important, but the email address must be a user in your Zendesk.
Use the user id in the following JSON to ensure the proper user is selected:
{"ticket":{"requester_id":99999999}}
The user id is located in the URL for the user:
You can set collaborators (CCs) at the same time with the following JSON:
{"ticket": {
"requester": {
"name": "Customer", "email": "sue.port@pretendco.com"
}
},
"collaborators": [
{"name": "Collaborator", "email": "ian.stahl@pretendco.com" },
{"name": "Second Collaborator", "email": "ian.turn@pretendco.com" }
]
}
collaborators
is an array, and must be in []
(brackets).
Expanding the default Watchman Monitoring Trigger
In this example, we will look for tickets from Pretendco that have the wm_new_ticket tag, and then remove the tag while changing the requester to their point of contact.
A separate Trigger will need to be created for each Group. Each trigger will change the requester to the point of contact for that Group. The following trigger is an example of how to build a trigger for a specific Group.
Triggers are evaluated in order from top to bottom.
Because each trigger removes the "wm_new_ticket" tag, other triggers which are looking for the "new" tag wiil not be processed.
For full details on the Watchman Monitoring Trigger, see Using Zendesk Triggers with Watchman Monitoring.
Permalink: https://www.watchmanmonitoring.com/zendesk-trigger-options
How can this article be improved?
Please sign in to leave a comment.