Setting up a HTTP target to make any change to a ticket (advanced)

Sometimes Zendesk triggers & automations don't provide all the automated actions you need to perform your required workflows on a ticket.

Examples of actions that triggers & automations do not have actions for are: 

  • Adding specific CCs to a ticket.
  • Automatically applying public/internal comments to a ticket.
  • Changing the subject line of a ticket
  • Setting the contents of the following types of ticket fields: 
    • text fields
    • multiline text fields
    • numeric fields
    • regex fields

When you run into one of these circumstances (or others) there is a workaround that allows you to still make the changes you want. This is to:

Step 1: Setup a HTTP target.

Step 2: In a Zendesk trigger/automation send the ticket changes to the target. 

Step 3: (Important!) Ensure that your trigger has a nullifying condition. 

 


 

STEP 1: Setup the HTTP target

The first step is to setup an HTTP target. To do this first click on the cog on the left of the screen, then scroll to the bottom and click on "Extensions". Then at the top right click on "add target" like this:

Pluto_-_Agent.jpg

Select HTTP target from the list:

Pluto_-_Agent.jpg

Name it "Update ticket". 

For the URL add in this: https://yourhelpdesk.zendesk.com/api/v2/tickets/{{ticket.id}}.json

(Replace yourhelpdesk with the name of your help desk)'

Set the method to "PUT"

...and the content type to "JSON"

Finally, tick the box to enable credentials and enter in your Zendesk credentials... it should look like this when you're done: 

 

Note: If you're using SSO on your desk, you will not be able to use your regular username and password. Instead, you will need to enter your username with /token at the end like this: peter@sweethawk.co/token and for the password, you will need to generate an API token - see here for more.

Once you're happy to go ahead and create the target.

 


 

STEP 2: In a Zendesk trigger/automation send the ticket changes to the target.

To create the trigger that will automatically make the changes you want, click on the cog on the left of the screen, then click on triggers, finally click on 'add trigger' at the top right-hand side like this: 

Pluto_-_Agent.jpg

Under "Meet all of the following conditions" you can put in whatever rules are required for the workflow you're trying to achieve. 

Under "Perform these actions" add the rules:

# "Notifications: Notify target" - "Update ticket" 

In the JSON body add the code that you want. Below are a few examples of things that you can do. For more information on setting things on a ticket using the Zendesk API see this article

 

Make a public comment: 

{
"ticket": {
"comment": {
"body": "This a public ticket update regarding ticket {{ticket.id}}.",
"public": true
}
}
}


Make a private comment: 

{
"ticket": {
"comment": {
"body": "This a private ticket update regarding ticket {{ticket.id}}.",
"public": false
}
}
}


Change the subject line: 

{
"ticket": {
"subject": {"My printer is on fire"}
}
}


Adding CCs: 

This has its own knowledge base article here

Setting custom ticket fields:

{
"ticket": {
"custom_fields": [{"id": 45844587, "value":"09:00"},{"id": 45844607, "value":"Melbourne"},{"id": 45844547, "value":"Support (1022)"},{"id": 45844627, "value":"60"}]
}
}

 


 

Step 3: Adding a nullifying condition. (Important!

It is very important that you add a nullifying condition to your trigger for these types with HTTP targets.

Since the trigger is causing the ticket to update its self, the consequence of it not being nullified means that the ticket will update its self hundreds (if not thousands) of times a minute until the trigger is manually disabled. For more information, see this article on how to setup nullifying conditions


Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.