Automatically adding calendar events to tickets (advanced)

You are able to set a calendar event on a ticket by setting specific ticket fields that the Calendar app uses behind the scenes and would normally only use to store its data in. The fields that need to be set to make this happen are:

  • Calendar event date
  • Calendar event time
  • Calendar event time zone
  • Calendar name
  • Calendar event duration (in minutes)

However, these fields can only be set using a trigger and that pushes its information to the ticket via a webhook. 

There are 4 steps to setting this flow up: 

1. Setting up the webhook

2. Getting the ticket field IDs ready to use in your trigger.

3. Getting the exact name and timezone.

4. Creating the trigger. 

 


 

STEP 1: The webhook

The first step is to setup a webhook. To do this, first, go into the Admin Center like this:

SweetHawk__-_Agent-2.jpg

Then under Webhooks, at the top right click on Create Webhook like this:

 

Screen_Shot_2021-10-15_at_12_09_03_am.jpg

Next, use the following details to configure the webhook:

Name: Update ticket

Endpoint URL: https://yourhelpdesk.zendesk.com/api/v2/tickets/{{ticket.id}}.json

Don't forget to replace "yourhelpdesk" with the name of your Zendesk domain.

Request method: PUT

Request format: JSON

Authentication: Basic authentication

You will need to enter your credentials for the authentication.

 

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.

 

It should look like this when you're done: 

mceclip2.png

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

 


 

STEP 2: Getting the ticket field ID's

In order to set the ticket fields in the trigger, we're going to need the ticket field ID's of certain calendar fields. You can get these by clicking on the cog on the left of the screen, then under Ticket Fields do a search for "Calendar". Copy the ID's for the following fields and make a note of them: 

  • Calendar event time
  • Calendar event time zone
  • Calendar name
  • Calendar event duration (in minutes)

Pluto_-_Agent.jpg

 


 

STEP 3: Getting the exact calendar name & timezone.

In order to know what to set the calendar name and timezone, you will need to check what's currently being used on a ticket. 

To do this create a test ticket in Zendesk and manually add a calendar event. 

Then check the events log of the ticket and you should see something like this:

SweetHawk__-_Agent.png

Note that there is an ID associated with any calendar name that you will need to copy as part of the name eg. "Support (1022)" as above.

 

For the timezone, an alternative way to get the acceptable timezone values is here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

 

Time Format: Note that the time format in the image above is HH:MM (ie. 14:30) ie. time should be set to 24-hour format. So if you wanted to set the time for anything before 10 am, say 8:30 AM, the correct value to use in for time will be "08:30". Do not forget to place a zero in front of the 8 or it will not be treated as a valid format.

 


 

STEP 4: Creating the trigger

To create the trigger that will automatically add the calendar event in the future 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:

# "Ticket: Calendar Date" - "Set to a number of days from now" - "[Enter the number of days you want]"

# "Notify active webhook" - "Update ticket" 

In the JSON body add this code: 

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

Replace the ID's listed above with the ID's you noted in step 2. Also set the value "Melbourne" to your timezone and the name of the calendar to match yours.

When you're done it should look something like this: 

SweetHawk__-_Agent.png

Finally, click on "Create trigger" at the bottom right-hand side and test it out. 


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

Comments

2 comments

  • Hi,

    Can we add "Description", of an event's calendar, as an internal note on ticket ?
    Thanks in advance.

    0
  • Hi Arnaud, great question. While there is a ticket field for the event description, I believe this has a different use case for why it exists and wouldn't work for what you're trying to do. I'd like to get some more information on your use case and will convert this into a ticket to discuss further.

    0

Please sign in to leave a comment.