Zendesk - Automatically changing the Requester

Last updated:

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.

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.

Click Admin Sprocket.

Select Channels > API

Channels > API

Verify that Token Access is Enabled.

Settings: Toekn Access Enabled

Click on the add new token link on the far right side of the Active API Token(s) header.

add new token

Provide a label for the API Token, such as "Change Requester" and click Create.

Label for API Token

Copy the new API token.

Generated API Token is displayed

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.

Click Admin Sprocket.

Select Settings > Extensions.

Settings > Extensions

Click the add target link on the right side of the target listing.

add target

Select the HTTP target >>

HTTP Target Extension

Give the HTTP target a Title such as "Change Requester"

HTTP target: Title

The URL for the target will be
https://ZENDESKSUBDOMAIN.zendesk.com/api/v2/tickets/{{ticket.id}}.json

HTTP Target: URL

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.

Method: PUT

Change the Content Type to JSON.

Content Type: JSON

Enable Basic Authentication

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.

Basic Authentication

Your HTTP target should look similar to the following...

HTTP Target

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

Test Target

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.

JSON body - Test

If the JSON is successful, you will receive a HTTP/1.1 200 OK and will look similar to this:

OK JSON Result

Clicking on the Response tab, at the top of the response, you should see the requester has changed.

OK JSON Response

With a successful test, select Create target and click Submit.

Create target

Create a Trigger

Click on the Admin icon or sprocket in the lower left corner.

Click Admin Sprocket.

Select Business Rules > Triggers.

Business Rules > Triggers

Add an action to your trigger by clicking the + button.

Add action

From the - Click to select action. - menu.

Click to select action

Select the Notifications: Notify target action.

Notifications: Notify target

In the secondary menu, select the Change Requester target.

Change Requester

In the JSON body: field enter the following JSON:

{"ticket": {"requester": {"name": "Customer", "email": "EMAILADDRESS"}}}

Your action should look like the following:

JSON Body

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:

Finding the User ID in the URL

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.

Watchman Monitoring Trigger with Change Requester

For full details on the Watchman Monitoring Trigger, see Using Zendesk Triggers with Watchman Monitoring.

Permalink: https://www.watchmanmonitoring.com/zendesk-trigger-options


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.