Approval Workflows with Airtable and Slack
As you may know, Airtable has direct integration with Slack 'out of the box'. In this article, I am going to discuss how to use this to build an absence approval workflow, starting from an employee's request through to notifying them of approval (or otherwise) - and with a little help from Zapier along the way.
The Base - KasPer Lite Available from the Airtable Universe
KasPer lite is a relatively simple HR App built on Airtable which I have produced and made available to all in the Airtable Universe. The base (Airtable's term for a database) includes an Absence Management area through which a company can manage their Holiday, Sickness and other leave (and of course it can be customised as required). One of the features included with this is a Form (Airtable Forms are for data entry only and can be embedded on your website or linked to directly) through which an employee can request leave:
On clicking Submit, this record will be entered into the base's Absence table:
You can see the record at the bottom of the list in the Main View.
Notice that the Approved/Checked field is NOT checked. This causes the record to be shown in a View called 'For Approval':
The purpose of this view is to drive the approval process (and to provide a simple view through which leave can be approved or denied). So now let's look at how we can use this setup to create the approval workflow itself.
The Start of the Process - Integration with Slack
From inside any base, there is a dropdown menu next to the Base name at the top of the screen. One of the options here is 'Slack notifications':
This option allows you to create notifications in a Slack 'channel' of your choice when data is added or changed in any Table / View in your bases. In this case, we are going to add a notification when a record appears in the For Approval View of the Absences base - in this way, we will NOT be notified when a user adds a record directly to the table and ticks the Approved / Checked field at the time of entry. First you select the Base and Slack Channel into which you want a notification:
For the purpose of this exercise, I have set up a specific Slack Channel into which I wand these notifications called leave_requests - you may use any channel. Once these are selected you can then choose to have all changes in the base notify you, just 'watched records or select a Table and View:
Clicking Done will enable the integration and then any records entered into the Absences table which are NOT Approved will cause a Slack notification - and this is what it will look like in Slack:
There are two interesting aspect here - firstly the notification includes most of the information the approver would need - and also it includes a link directly to the record to approve it (highlighted by yellow borders). Clicking one of these links will take the user directly to the relevant Airtable record in Expanded view:
So the record can be directly edited here after just one click.
So we now have a process where absences can be authorised - but what about letting the employee know? The simplest answer would be to set up another Slack notification to another Channel where employees could see updates - but this isn't keeping employee information very secure and should be avoided. Better to send an message directly to the employee to notify them. To enable this, we have 2 other Views in the Employee Table called 'Approved / Checked Leave' and 'Denied Requests'. What we're going to do next is to add a Zap which looks at this View and when there's a new record, sends an Slack direct message to the employee.
Sending the Approval message to the Employee from Zapier
To simplify this process (for when we get to Zapier), we have added a Lookup field to the Absences table which gets the employee's email address to the Absences table - and another for their First Name. Generally these would be hidden in the Absence Views. If you have an earlier copy of KasPer Lite from Airtable Universe then you need to add these yourself - but the latest version includes them.
So let's set up the Zap - first we'll select Airtable as the Trigger app and the KasPer Lite base, Absences Table and Approved / Checked Leave view:
and now the step's options:
So, now we have a Zap which will look for new records in this view. Now we need to configure Zapier to send the message. The first issue is that we have the employee's email but not their Slack identifier - to resolve this we'll search Slack for the person based on their email address:
So, now we have found the Slack user, the next step is to send them the message:
and the message configuration:
So in the to box, we select the ID of the Slack user found in the previous step and the message itself should be fairly explanatory. You can then specify a 'Bot' name and, optionally an icon - these will identify to the recipient 'who' the message is from. In this case I have called it KasPer Lite and provided a link to the app's logo on my website.
And here's the message as received by the user:
Note that this handles the messages for Approved leave requests. You can effectively duplicate this process for denied requests by using a Zap based on new entries in the 'Denied Requests' view - apart from this and the actual text of the message the zaps would be the same.
Note that, because this Zap has 3 steps, you would need a paid Zapier account. If you only have a free account then you could still achieve this but would need to store the employee's Slack user ID in Airtable and have it as a Lookup field in the Absences table.
This is just one example of how you could use Slack and Zapier to automate workflows around Airtable. I hope you've found this article useful and please feel free to make any comments or suggestions!