Welcome to a practical Zapier tutorial! In this guide, you'll learn how to send digital calendar invites whenever a customer makes a booking on your marketplace.
Your marketplace sends email notifications by default, but these notifications don't include a link to add the event to the recipient's online calendar. This tutorial shows you how to extend your marketplace's capabilities using Zapier to send calendar invites in .ics format, which users can use to add the event to a digital calendar like iCal or Google Calendar.
Already familiar with setting up zaps? Find the Zap template here: Automated digital calendar email invites with Sharetribe
If you haven’t gone through the introduction and the action/event article of our Zapier collection, we encourage you to do so to better understand how things work. If you want to dive straight into action either way, read on!
What is Zapier?
Zapier is a powerful and versatile tool that allows you to integrate different services to one another. You can learn more about Zapier in our introductory article or through this brief video from Zapier.
What do you need for this tutorial?
External accounts
You need a Zapier account, which you can sign up for at www.zapier.com. When registering, the process may ask you which Zapier apps you want to use. You can already find and select ‘Sharetribe’ from the list of applications, but you can also add it later.
The free plan with Zapier has a limitation: it's only possible to create single-step Zaps. So while you can follow through this tutorial, actually using this Zap requires you to have at least a Starter plan for Zapier, which supports multi-step zaps.
You will also need an email client supported by Zapier. The role of this client is to send the calendar invites via email. If you already have a custom outgoing email configured, it is best to use this same address if possible so that all your email communications come from the same address. In this tutorial, we will use Google's Gmail.
How to set up your marketplace
This tutorial assumes you are using Calendar booking transaction settings. The tutorial uses hourly booking units, but it will also work with daily or nightly units.
In order for Zapier to be able to draw relevant information from your marketplace, you will need to have some activity there. Since we will be setting up a Zap that sends an email to the participants of a calendar booking event, you should have at least one such booking transaction in your marketplace. You can run this transaction in your Test environment.
Make sure that your test transaction only reaches the state where a booking is accepted by the provider. This means the transaction has been accepted, but the booking period has not yet passed. The best way to ensure this is to book at least a few days in advance to give you some time to properly configure the Zap.
With these pieces in place, let's get started!
Getting your Integration API key from Sharetribe Console
Navigate to Build > Advanced > Applications
Click on “+ Add a new application”
Give the application a descriptive name (like Zapier), and select ‘Integration API’.
Click ‘Add application’.
Important: Copy and paste the Client ID and Client secret to a safe place, like a password manager.
Think of the Client ID and secret as a sort of a password to your marketplace that can be used through other services. Note that you won’t be able to ever see the Client secret to this application again in the Console under any circumstances. Make sure you copy it to a secure place. If you lose it, you will need to create a new application.
Creating a digital download listing type
Log in to your Console at https://console.sharetribe.com/.
Navigate to Listings > Listing types.
Click on ‘+ Add a new listing type’.
Enter a descriptive listing type name, such as “Hourly bookings”.
Choose a descriptive listing type ID, such as hourly-bookings (note that spaces can’t be used here).
Choose ‘Calendar booking’ as the transaction process.
Choose ‘Hourly’ as the booking unit (assuming you are setting up an hourly bookings marketplace).
Adjust default listing fields as you see fit.
Click on the green ‘Save changes’ button at the bottom of the page.
Creating the booking email Zap, step by step
(Optional) Importing a pre-existing Zap
Go to www.zapier.com and log in with your account (or create a free one if you don't already have one).
Click on ‘Try this Zap'.
Now, a lot of the work has already been done for you. You can use the steps below to verify that each step is configured correctly.
Step 1: Find a recent transaction from your marketplace
Connect your Sharetribe account by entering your Client ID and Client secret.
Click ‘Continue’ to move to the ‘Trigger’ section.
Choose ‘Transaction transitioned’ as the ‘Event type’.
Click ‘Continue’ to move to the ‘Test’ section.
Test the trigger, and make sure it finds a recent transaction event associated with a calendar booking listing, which has been accepted by the provider.
Click ‘Continue with the selected record’ to move to the next step.
Step 2: Get transaction details
Choose ‘Sharetribe’ as the app for this step.
Choose 'Show Transaction' as the event.
In the ‘Account’ section, choose your marketplace account (the one you configured in the last step).
In the ‘Action’ section, select “1. Transaction id: xxx” from the drop down list. It should be the top option. Do not write it in: you need to select it from the drop down menu for it to work.
Under ‘Included relationships’, choose ‘Marketplace’, ‘Listing’, ‘Provider’, ‘Customer’, and ‘Booking’.
In ‘Should this step be considered a “success” when nothing is found?’, select ‘No’.
Test the step and see that you get the transaction details from your test transaction.
Step 3: Filter the event
We want to only run the zap in a situation where a booking has been accepted. For this step, choose ‘Filter’ as the app from the ‘Built-in tools’ list by Zapier. You can select it from the on-screen list if you see it, or search for it – in search results, it appears as ‘Filter by Zapier’.
Under the ‘Only continue if…’, select the following 3 entries for the lines:
‘2. Transaction Listing Public Data Listing Type’
(Text) Contains
Insert your Listing type ID here. If you can’t remember it, check it from the Sharetribe Console, under Listings → Listing types. For example, it could be ‘hourly-booking’ or something else: make sure to double-check this.
Create another rule with the “+ And” option, so that two conditions have to be fulfilled.
Under the “And”, select the following 3 entries:
‘2. Transaction Last Transition’
(Text) Contains
accept
Test the filter, and make sure it says “Your Zap would have continued for this test data”
Troubleshooting: If this step fails, make sure you selected the right variables, and entered the right texts in the fields. Also, make sure that the last thing that happened in your test transaction was the accepting of the booking request by the provider!
Click ‘Continue’ to move to the next step.
Step 4: Format event start time for the email
The time we get from the marketplace is in a very technical format. We want to include it in the outgoing email in human readable format. We need two steps for this: one for the start time, another for the end time.
Choose ‘Formatter by Zapier’ as the app.
Choose ‘Date / Time’ as the event.
Under ‘Action’, click on the ‘Transform’ dropdown, and choose ‘Format’.
In the ‘Input’ field, select from the drop-down ‘2. Transaction booking start: xxx’.
In the ‘To Format’, choose MMMM DD YYYY HH:mm:ss (January 22 2006 23:04:05).
Note that you can also choose a different format if you prefer.
In the ‘To Timezone’, choose ‘2. Transaction Listing Availability Plan Timezone: xxx’, which should mention your own timezone.
In the ‘From Format’, select ‘YYYY-MM-DDTHH:mm:ssZ (2006-01-22T23:04:05-0000).
In the ‘From Timezone’, choose ‘UTC’ from the drop-down menu.
Step 5: Format event end time for the email
This step is exactly the same as above, except in the ‘Action’ section, choose ‘2. Transaction Booking End’ as the Input value in the 'Action' section.
Step 6: Format event start time for the calendar file
The calendar file requires a specific time format, which differs from the one given by the marketplace system. We’ll need to create three separate steps for converting the required timestamps.
Again, choose ‘Formatter by Zapier’ as the app.
In ‘Action’, in the ‘Transform’ drop-down menu, choose ‘Format’.
In the ‘Input’ field, choose ‘2. Transaction Booking Start’.
In ‘To Format’, write in YYYYMMDDTHHmmss (or you can just copy paste it from this sentence).
In ‘To Timezone’, choose ‘UTC’.
In ‘From Format’, choose ‘YYYY-MM-DDTHH:mm:ssZ (2006-01-22T23:04:05-0000).
In ‘From Timezone’, choose ‘UTC’.
Step 7: Format event end time for the calendar file
This step is exactly the same, except you’ll choose ‘2. Transaction Booking End’ in the ‘Action’ section’s ‘Input’ field.
Step 8: Format time of booking for the calendar file
This step is exactly the same, except you’ll choose ‘1. Event Created At’ in the ‘Action’ section’s ‘Input’ field.
Step 9: Create filename using transaction ID
Here, we’ll create a unique filename for the calendar file, by using the unique transaction ID. We will trim (or ‘truncate’) it to a shorter form.
Again, choose ‘Formatter by Zapier’ as the app.
As the ‘Event’, choose ‘Text’.
Under ‘Action’, in the ‘Transform’ drop down, choose ‘Truncate’.
In the ‘Input’ field, choose ‘1. Transaction Id: xxx’.
In ‘Max Length’, write in 14.
In ‘Skip Characters’, write in 24.
Test the step: it should give you a short sequence of numbers and letters, taken directly from the transaction ID.
Step 10: File From Text in Files by Zapier
In this step, we will finally create the calendar invite file from all the available data.
As the App, choose ‘FIles By Zapier’.
As the Event, choose ‘File From Text’.
In the Text field, type in the text shown in the grey box below. Be very careful to select the correct variables. If you want, you can modify the ‘Description’ variable, and/or leave out things like the location and organizer, but they are now included in this example.
In the below text, the variables that you need to choose from the drop down menu (instead of writing them in) are preceded by the step number (like 6. Output). It is necessary to choose them from the drop down menu to ensure that this file is generated correctly for each transaction.
Note specifically that you will need to manually add the Z at the end of DTSTART and DTEND variables. So those lines will look something like “DTSTART: 6. Output: 20240610T100000Z’
In the 'Filename (including extension)' field, you can enter text and variables. You can use the output from step 9 here, for example in this way (note the .ics extension at the end):
booking-9. Output: XX.ics
When done, make sure to test the step, to ensure that the file is properly created.
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
SUMMARY: 2. Transaction Listing Title:
DTSTART: 6. Output: Z
DTEND: 7. Output: Z
DTSTAMP: 8. Output:
DESCRIPTION:This is an automatically generated calendar event for the booking of 2. Transaction Listing Title: on 2. Transaction Marketplace Name:
LOCATION: 2. Transaction Listing Public Data Location Address
ORGANIZER: 2. Transaction Provider Profile Display Name
STATUS:CONFIRMED
PRIORITY:1
END:VEVENT
END:VCALENDAR
Step 11: Send calendar link via email to participants
Now, we will send the email that includes the calendar file, and details about the booking.
In the ‘App’, choose ‘Gmail’ (or your preferred Zapier-compatible email provider).
In the ‘Event’, choose ‘Send email’.
In the ‘Account’ step, choose the email account that you want the automated emails to come from. Note that this will be visible to both participants of the transaction as the sender email, so it should be clear that the email account is associated with your marketplace.
Under ‘Action’, select two recipients in the ‘To’ field: ‘2. Transaction Customer Email’, and ‘2. Transaction Provider Email’.
In the email ‘Subject’, you can add a mixture of text and variables. For example:
Calendar link for ‘2. Transaction Listing Title: xxx’ on ‘2. Transaction Marketplace Name:xxx’
In the ‘Body’ section, you can again type a mixture of text and variables. Again, make sure you select the variables from the drop down list, and not write them in - otherwise, they won't work. For example:
Hello there!
You're receiving this email because of the recent booking of 2. Transaction Listing Title: xxx on 2. Transaction Marketplace Name: xxx. Attached to this email is an .ics digital calendar event that you can use if you're using a digital calendar. To use it, you'll need to open the attachment from this email.
Note that some devices may not support the .ics file type. In this case, if you want to add the information to your calendar manually, you can use the booking details below. Note that the times listed below are in the marketplace's time zone: 2. Transaction Listing Availability Plan Timezone: xxx
Event name: 2. Transaction Listing Title: xxx
Booking start time: 4. Output: xxx
Booking end time: 5. Output: xxx
Location: 2. Transaction Listing Public Data Location Address: xxx
If you have any questions, don't hesitate to contact the 2. Transaction Marketplace Name: xxx team! You can contact us on the marketplace, or by replying to this email.
Regards, The team at 2. Transaction Marketplace Name: xxx
8. Finally, in the ‘Attachments’ section, choose ‘10. File(Exists but not shown)’.
9. Now, test the step. Make sure that the provider and the customer that were involved in your test transaction get the emails with the calendar booking link attached.
Final thoughts
Thanks for reading this tutorial about creating a Zap for your Sharetribe marketplace to send email calendar invites for successful bookings! Feel free to read through other parts of our Zapier guide as well: the introduction and the article about Events and Actions. Also, check out our other Zap templates from this article.
Please get in touch with us through your Console or from the bottom right section of this page from the chat widget if you have any questions about this guide, or anything else. We'll be happy to help!