Tutorials

How to Create an Emergency Communication System Using Airtable And Integromat

In this tutorial, you will learn how to create an Emergency Communication System like the one we featured recently on our blog.

What this scenario does:
There are 2 forms on Airtable:
1. For a person that requires assistance (Patient)
2. For Volunteers

A patient or a volunteer submits the Airtable Form that applies to them and the details are recorded on the table. When the scenario executes, the patient gets assigned an available volunteer or informed if there are no volunteers currently available. The patient and volunteer are notified of the result via SMS or email.

Level Of Difficulty: Intermediate

Implementation Time: Approximately 30 mins

Assumptions: You have an Airtable and Google account with the connections added and the Integromat App installed on your mobile device. You can copy the Airtable base template complete with the table and both forms. You are familiar with Routers and Filters.

Whilst in the midst of a global pandemic, we are reminded that our health is of vital importance and truly is, our wealth. With that being said, it’s important that our health infrastructure is not overwhelmed and one way we can help is by assisting each other with the basic needs in our neighborhood or vicinity. This system connects people who require assistance with selfless volunteers. Let us walk you through the tutorial.

Configuring the scenario

The scenario consists of the following modules:

  • Airtable > Search records (Patients without a Volunteer)
  • Airtable > Search records (Volunteers)
  • Routers
  • Airtable > Update a record (Update a patient)
  • Android > Send a text message (Text SMS sent to Volunteer)
  • Android > Send a text message (Text SMS sent to Patient)
  • Gmail > Send an email (Email sent to Volunteer)
  • Gmail > Send an email (Email sent to Patient)
  • Android > Send a text message (Text sent to Admin)
  • Gmail > Send an email (Email sent to Admin)

Here’s the scenario with the filters numbered which will be referred to throughout the tutorial:

 

In the tables, there are 2 very important configurations that are required. First, click on the Volunteers table. Then, go to the Patients field and click Customize field type. It’s imperative that you link the Patients table here in order to add the records to this field. Below, switch on the Allow linking to multiple records and Show linked records in reversed order:

 

Second, you need to keep count of the number of Patients the Volunteer is assigned to in order to not exceed the maximum. In the Count_Patients field, click the Customize field type and select the Count option. In the menu below, select the Patients field:


In the scenario, click on the trigger module which is the Airtable > Search records (Patients without a Volunteer) module in the scenario. Select the Base and the Patients table from the menus. In the Formula field, enter Volunteers = ‘’ so that it only searches for rows where the volunteer field is empty which means that the patients don’t have an assigned volunteer:

 

The route between the first Airtable > Search records (Patients without a Volunteer) module and the second Airtable > Search Records (Volunteers) module contains a filter. (1)

Filter’s function: Only when the total number of bundles is greater than 0 will it pass through this filter. This prevents the subsequent modules from being processed unnecessarily saving you operations and saving your scenario from resulting in an error.

Map the Total number of bundles element outputted by the Airtable > Search records (Patients without a Volunteer) module to the Condition field. Then, select the Greater than Numeric operator and enter the number 0 in the field below:

 

Next, click on the Airtable > Search records (Volunteers) module to configure it. Select the Base as you did previously but here, select the Volunteers table. Since each volunteer is assigned a maximum of 4 patients only, you need to search for a volunteer that currently has less than 4 therefore, in the Formula field, enter {Count_Patients}<4: *Please note that 4 is only for example purposes of how many people a volunteer can assist, you can change the number at your discretion.*

 

For the system to be even more efficient, you can find a volunteer with the least amount of patients and assign a new patient to him/her first. To do this, scroll down and click on the edit button under the Sort option. Select the field (which is the patient count) and select Ascending under Direction:

 

You can set the Max records to 1 as this is the total number of records Integromat will return during 1 scenario execution:

 

Volunteer Available

Following the second Airtable module is a Router which splits the scenario into 4 routes:

 

Let’s open the filter on the route between the Router and the Airtable > Update a record (Update patient) module (top route). (2)

Filter’s function: Allows the bundle to pass through only if there is an available volunteer.

Map the ID element from the Airtable > Search records (Volunteers) module to the Condition field and select the Exists operator:

 

Let’s continue along the route after the Airtable > Update a record (Update patient) module. There is a second Router that further splits the scenario into an additional 4 routes while each route contains a specific filter:

 

The modules on these routes notify the Patient and Volunteer about the new assignment by either a mobile text message or email depending on their preferred method of communication.

The first 2 routes are to notify the Volunteer:

 

Click on the route between the Router and the Android > Send text message (Text SMS sent to volunteer) module to configure the filter. (3)

Filter’s function: Allows the bundle to pass through only if the Volunteer chose to be notified by Phone.

Map the Preferred method of communication element to the condition field, select the Equals text operator and type in Phone in the bottom field:

 

Now configure the Android > Send text message (Text SMS sent to volunteer) module. First, you need to map the elements outputted by the Airtable > Search records (Volunteers) module. In the Recipient field map the Phone number element and in the message field, map the Name element after ‘Hello’:

 

Next, map the other elements (patient’s details) outputted by the Airtable > Search records (Patients without a volunteer) module to the message in the relevant positions. The newline keyword is found under the Text and Binary function tab.

Add the join function found under the Functions for working with arrays tab which lists all the items from an array (symptoms in this case). In the brackets, map the Symptoms[] array and enter a comma after the semi-colon:

 

Moving on to the filter between the Router and the Gmail > Send an email (Email sent to volunteer) module. (4)

Filter’s function:  Allows the bundle pass through only if the Volunteer chose to be notified by Email. 

Configure the filter the same was as you did with the previous filter except type Email in the bottom field:

 

In the Gmail > Send an email (Email sent to volunteer) module, map the Email address and Name elements outputted by the Airtable > Search records (Volunteers) module to the Recipient and Content field respectively.

As you did in the preceding Android module, map the elements outputted by the Airtable > Search records (Patients without a volunteer) to the content in the relevant positions. You can use HTML tags in this box if you prefer:

 

The second 2 routes are to notify the Patient:

 

Click on the route between the Router and the Android > Send a text message (Text SMS sent to Patient) module.(5)

Filter’s function:  Allows the bundle to pass through only if the Patient chose to be notified by Phone.

Map the Preferred method of communication element from the Airtable > Search records (Patients without a volunteer) module, select the Equals to operator and type Phone in the bottom field:

 

Open the Android > Sent text message (Text SMS sent to Patient) module. Here, map the Phone number and Name (after ‘Hello’) elements outputted by the Airtable > Search records (Patients without a Volunteer) module. Then, map the elements from the Airtable > Search records (Volunteers) in the relevant positions within the text:

 

Open the route between the Router and the Gmail > Send an email (Email sent to Patient) module to configure the filter. (6)

Filter’s function:  Allows the bundle to pass through only if the Patient chose to be notified by Email.

Set up this filter the same as you did with the previous filter but type Email in the bottom field. Next, configure the Gmail > Send an email (Email sent to Patient) by mapping the relevant elements in the fields and text:

 

No Volunteer Available

Now let’s go back to the first Router after the Airtable > Search records (Volunteers) module:

 

If there are no available Volunteers, a message is sent to the Admin via Text SMS and Email that a Patient does not have an assigned Volunteer. A message is also sent to the Patient by either Text SMS or Email informing the Patient that there are no available Volunteers but the Admin is working on a solution.

Click on the route between the Router and the Android > Send text message (Text SMS sent to Admin) module to configure the filter. (7)

Filter’s function: Allows the bundle to pass through only if the ID does not exist meaning that there is no Volunteer currently available.

Map the ID outputted by the Airtable > Search records (Volunteers) module and select the Does not exist operator:

 

Next, click on the Android > Send text message (Text SMS sent to Admin) module and enter the Admins mobile number in the Recipient field. Enter the text and map the elements from the Airtable > Search records (Patients without a Volunteer) module to the relevant positions:

 

Now open the Gmail > Send an email (Email sent to Admin) module and enter the Admin’s email address and content with the relevant elements from the Airtable > Search records (Patients a without Volunteer) module:

 

Open the route between the Router and the Gmail > Send an email (Email sent to Patient) module. (8)

Filter’s function: Allows the bundle to pass through this filter only if the ID does not exist AND the Patient chose to be notified by Email.

Set up the filter as you did with the previous filter but now add the AND rule. Then, map the Preferred method of communication outputted by the Airtable > Search records (Patients without a volunteer) module, select the Equal to text operator and type Email in the bottom field: 

 

Configure the Gmail > Send an email (Email sent to Patient) module by mapping the Email address element to the Recipient field and the Name element to the text that message you want to send to the Patient:

 

Finally, open the route between the Router and the Android > Send a text message (Text SMS sent to Patient) module. (9)

Filter’s function: Allows the bundle to pass through only if the ID does not exist AND the Patient chose to be notified by Phone. Picture to show which filter is being referred to.

The filter’s setup is similar to the previous one except you need to type in Phone in the bottom field:

 

In the Android > Send a text message (Text SMS sent to Patient) module, map the Phone number and Name elements outputted by the Airtable > Search records (Patients without a Volunteer) module to the Recipient field and Text respectively:

 

You are now done configuring the scenario! Let’s take a look at the result of the scenario execution.

Scenario execution

Here, 2 patients submitted the Request for assistance form, were added to the table and were automatically assigned a volunteer:

 

Here you see the volunteer’s details after submitting the Volunteer form and the 2 patients that were automatically assigned to him/her:

Using an instant trigger

If you have an Airtable PRO account, you can use a custom webhook in your scenario to instantly receive the information when a form is submitted. This gives you the option of having 2 scenarios for more efficiency, 1 for the Patient and other for the Volunteer.

When the Patient submits the form and the details are recorded on the table, the Patient scenario is instantly triggered (instead of scheduling to execute every 15 minutes) and the same applies to the Volunteer form. The major benefit is that the patient and the volunteer get the response instantly. If there is a patient without a volunteer and a new volunteer is registered, that volunteer is assigned to the patient immediately.

To configure this, add the Webhooks > Custom webhook trigger module to the current scenario which is now the Patient scenario. Add/select a Webhook and copy the link:

 

Go over to the Patient form on Airtable and switch on the option to Redirect to URL after the form is submitted located at the bottom:

 

A box will appear, paste the URL and add ?record_id={record_id} at the end of the link. When the Webhook receives the trigger, it will also include the Record ID:

 

Next, add the Airtable > Retrieve a record module. Add a connection then select the base and table. You need to first execute the scenario (switch the scenario on and submit the form) in order to map the Record ID element outputted by the Webhooks module:

 

The last step is to delete the Airtable > Search records (Patients without a Volunteer) module. Once done, you will notice that the modules require remapping. Simply replace the elements (now in black) that was previously mapped from the Airtable > Search records (Patients without a Volunteer) module with the elements outputted by the Airtable > Retrieve a record module:

 

Here is the new Patient scenario:

 

The same process should be followed for the Volunteer scenario. You will notice that the Volunteer scenario is a bit different when compared to the Patient scenario:

And that’s it!

As you see from this tutorial, the system saves you time from organizing and mobilizing people allowing you to concentrate on key areas such as finding equipment or sourcing funds. The sooner you apply the scenario the sooner you can get ahead of flattening the curve. Every little bit of help we can provide counts in this pandemic.