# Automations with Triggers

Combining Zendesk Triggers and Cronofy Scheduling you can automate scheduling for your team.

A typical example of this would be to setup an automated message to a customer to schedule time with an agent when a particular `Tag` is added to a Ticket, perhaps with a Zendesk Macro.

![](/integrations/zendesk/automation-with-triggers/automatic-ticket-comment.040c366310e91c28e9842a97f55b2ca53dae529a812d7e5129ea20d7ba74fdcd.png)
This document will walk your through

- Setting up the Cronofy Scheduling Trigger.

- Adding a Web Hook to Zendesk.

- Triggering the Web Hook when a Tag is added to a Ticket in Zendesk.

## Setting up the Cronofy Scheduling Trigger
The first step is to set up the Cronofy Scheduling Trigger that creates the Scheduling Request and adds the Comment to the Zendesk Ticket.

![](/integrations/zendesk/automation-with-triggers/create-trigger.1e0f76895043da26fe62e0a1b8371d9a1442c96251da86ebd1b0557f573928a6.png)
Click on **Create a Scheduling Trigger**. Provide a *Name* and you'll be presented with a screen like this. We've chosen to call our Trigger *Schedule Time* in this example.

![](/integrations/zendesk/automation-with-triggers/new-zendesk-scheduling-trigger.2694690fa5f36dadbd19c378364cd92c367250be2417cd6251941625f4532745.png)
You'll see that you have fields for the Ticket Comment and the Event Summary and Description that get created when the recipient picks a time. Amend these to support your requirements.

There are several mail-merge style fields you can use, eg `{{ zendesk.ticket.requester.first_name }}` so you personlize these. If you need other fields added, let our support team know.

Click **Save** and you're ready for the next step.

## Adding a Web Hook to Zendesk
Instructions for registering a Web Hook with Zendesk are covered in [Creating webhooks in Admin Center](https://support.zendesk.com/hc/en-us/articles/4408839108378-Creating-webhooks-in-Admin-Center).

You'll notice at the foot of the Scheduling Trigger page there is a section titled *Web Hook Settings*. Click **Show** to reveal these fields.

![](/integrations/zendesk/automation-with-triggers/zendesk-web-hook-settings.a4aa7a959c2bba89064d9345617d47d528f733e40955ca7860e163053fee8955.png)
You'll find the *Endpoint URL* and the *Username* and *Password* for **Basic Authentication**. Enter those values into the web hook settings. Also:

- Request method: `POST`

- Request format: `JSON`

Save the Web Hook.

![](/integrations/zendesk/automation-with-triggers/create-zendesk-web-hook.b5608b3e65c3b52ebf91194b3ab08f9840a87d6943ba1ce1409d2102f7a558f1.png)
You'll then see the option to reveal the **Secret key**.

![](/integrations/zendesk/automation-with-triggers/zendesk-web-hook-secret.0ab46746f7b6db3caad1d955bd1851a28075fe8af2e41bc304c89b51ce0ad5ba.png)
Click **Reveal secret** and then **Copy**. Paste that into the *Secret Key* field on the Cronofy page.

![](/integrations/zendesk/automation-with-triggers/zendesk-web-hook-settings.a4aa7a959c2bba89064d9345617d47d528f733e40955ca7860e163053fee8955.png)
And click **Save**.

## Triggering the Web Hook
A simple way of triggering the web hook is to do so when a `Tag` is added to a Ticket. This can be achieved with Zendesk Triggers. If you're new to Zendesk Triggers or want to a refresher, the [Zendesk Trigger Documentation](https://support.zendesk.com/hc/en-us/articles/4408843730458) is a great place to start.

The first part is to set up the *Conditions* for the Trigger. In this example we're going to run this Trigger when a ticket us updated and the `auto_schedule` Tag is added. You can use whichever tag values make sense for you.

![](/integrations/zendesk/automation-with-triggers/zendesk-trigger-conditions.6608cd692165f7a2ca638ab79b38cd6add735c68f5fa331ab7f64e73df793de4.png)
Then we set up the *Actions*.

![](/integrations/zendesk/automation-with-triggers/zendesk-trigger-actions.f25f0c1fc81de411d452a07c0ab27601164b0da17bfca92ccd719122dffaa9fa.png)
The value of *JSON Body* can be copy and pasted from here:

```
{
  "ticket": {
    "id": {{ticket.id}}
  }
}```
You must include an action to remove the `auto_schedule` Tag to ensure we close the loop once the scheduling link has been generated.

## All Done!
That's it. Now, whenever a Ticket is updated with the `auto_schedule` Tag a new Scheduling Request will be generated for the assigned Agent and a Comment added to the Ticket with the details for the customer.

We're adding new capabilities to the Zendesk integration all of the time. So if there are other ways you'd like it to work please get in touch through our [support team](mailto:support@cronofy.com?subject=Zendesk%20Integration).


---
[Read in HTML](/integrations/zendesk/automation-with-triggers/)
