In this tutorial we set up a Zapier automation that automatically creates an Outlook calendar event whenever we create a task that has "[Event]" in the task name. PLUS we'll have that Outlook calendar event contain a link to the task in Hivelight.
This can be useful when certain tasks in your matter are associated with events. Having the event created automatically saves data entry. This is also good inspiration for how to use the webhooks - what other events in Hivelight might be useful for trigging automations in other apps?
Set up the Hivelight Webhook to talk to Zapier
Open Zapier and start a new Zap. Select the Webhook module and choose the 'Catch Hook' event. Now go to 'Test' and copy the webhook URL it gives you.
Next you'll need to set up a webhook in Hivelight (Webhooks tell another application that you specify about certain events - in this case, we'll set up a Webhook in Hivelight that tells Zapier whenever a new task is created in Hivelight).
Go to Settings > Integrations > Webhooks
Under 'Select event' choose 'task.created'. Delete the content under 'Secret'. Under 'Webhook URL' paste the webhook URL you got from Zapier and click on 'Test'. Then click on 'Create webhook'.
Go to a Hivelight matter and create a new task. This will trigger a new event to fire for the new webhook you set up.
Click on 'Find new records' in the 'Catch Hook' module in Zapier, it should show some options like 'request A', 'request B' etc. Pick one and click on it to see the contents ("payload") of the webhook event sent from Hivelight. It should look familiar, from the task that you just created in Hivelight.
Set up the automation (or 'Zap') to only complete when a task is created with "[Event]" in the title
We want to set things up so that Outlook calendar events are only created when we want them.
To do this, we'll create a filter that causes events to be created only when the text "[Event]" is included in the task name.
Add a 'Filter' module. Under 'Only continue if' select "1. Data Attributes Name". Then the '(Test) Contains' condition. and enter "[Event]" (without the quotes).
Then select another condition "1. Data Attributes Status". and '(Text) Exactly matches' and enter "TODO" (without the quotes).
This will cause the filter to only allow through events where the task name contains '[Event]' and it is a new task (as new tasks all start with the status of 'TODO'.
Get the date the task was created
We will need to feed the Outlook stage of the automation with a human readable due date. But the webhook gives us the task due date in a computer-readable format.
So, add a 'Formatter' module. Under 'Action event' select 'Date / Time'.
Under 'Transform' select 'Format'.
Under 'Input' select '1. Data Attributes Due Date'.
Under 'To Format' select 'YYYY-MM-DD'.
Get the matter and task ID
We want to get the matter and task ID so that we can create a link in the Outlook calendar event back to the task.
To do this we need to grab the string provided by the webhook that contains the matter and task ID, and split it.
Add a 'Formatter' module. 'Action event' set to 'Text'.
'Transform' set to 'Split Text'. 'Input' set to '1. Included ID'. 'Separator' set to "," (without the quotes). 'Segment Index' set to 'First'.
Next, we add another 'Formatter' module. 'Action event' set to 'Utilities'.
'Transform' set to 'Pick from list'. 'Operation' set to 'Choose Last'. 'Input' set to '4. Output'. I.e. we a grabbing the output of the previous Formatter step and selecting the second part of it.
Create the Outlook Calendar Event
Add a 'Microsoft Outlook' module.
'App' set to 'Microsoft Outlook'. 'Action event' set to 'Create Event'. Under 'Account', connect your Outlook account.
Set the 'Calendar' field to the Calendar in your Outlook that you want to add the events to (i.e. you may have more than one calendar being displayed - personal, work, public holidays etc).
Under 'Subject' you can configure the naming of events created from your tasks. In the example video above, we have used the following:
[1. Data Attributes Name] RE: [1. Included Attributes Name].
This results in a format of [Task Name] RE: [Matter Name]. But you can pick any naming convention you like.
'Start Date & Time' set to '3. Output'. This is the date that we converted above, being the task due date.
'End Date & Time' set to '3.Output' +1. We have just set this to be an approximation for the duration of the task. This can be changed to amount to any event duration you want to use.
Now go to your Hivelight app, select the url and copy the content from 'https' through to 'matters'.
Under 'Description' enter:
View on Hivelight: [past the above URL content here]/[5. Output]/t/[1. Data Id]
Matter Name: [1. Included Attributes Name]
This amounts to the format of your Hivelight account, workspace id, matter id, and task id. and then we include the matter name at the end.
This will cause the event description to contain a link to the task and to list the associated matter name.
Publish
There! now it is time to publish your Zap and try it out.
Create a new task in a Hivelight matter, include the text "[Event]" in the task name, and watch it appear in your Outlook calendar as an event.
Click on the event, copy the task URL and paste it into your browser to go to the associated task in Hivelight.
Note:
By default the event will be assigned to you in Outlook (or whoever's credentials were used to connect the Zapier account to Outlook).
For bonus points you can invite the task assignee to the event. You do this by requesting the email of the task assignee via the Hivelight API and feed that to the Outlook module.
Add a 'Webhooks' module. 'Action tevent' set to 'GET'.
URL set to:
(Global accounts): https://api.hivelight.com/v1/users/[1. Data Attributes Assignees]
(Australian region account): https://au.api.hivelight.com/v1/users/[1. Data Attributes Assignees]
This has the effect of passing the task assignee's ID to the API which will return their email. Which in turn can be added to the Outlook module that is creating the event (see 'Attendees').
Under 'Headers' enter:
In row one: "x-api-key" in the left box (without the quotes) and then your API key in the right box.
In row two: "Content-Type" in the left box (without the quotes), and then "application/json" (without the quotes) in the right box
You can find the instructions for creating an API key here.