All Collections
Integrations
Zapier
Zapier tutorial: SMS booking notifications via Twilio
Zapier tutorial: SMS booking notifications via Twilio

Learn how to set up SMS notifications using Twillio.

Vesa Vahermaa avatar
Written by Vesa Vahermaa
Updated over a week ago

Welcome to a practical Zapier tutorial! In this guide, we’ll go through the process of connecting a Sharetribe marketplace to Twilio via a Zapier automation. Specifically, what we are building here is an automated SMS message notification that is sent to the providers on your marketplace whenever a transaction is initiated with them, so they can quickly react to the booking request or the message.

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, feel free to 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 is Twilio?

Twilio is an online service that provides a variety of communication-related services, including SMS messaging, Whatsapp, voice calls, video calls, chat and messaging, and more. It can be used for a variety of tasks, but in the context of this tutorial, we’ll be using it to set up automatic SMS notifications to the sellers of your marketplace, notifying them every time there’s a booking made.

If you prefer Whatsapp notifications, you can try customizing this tutorial to work with them instead of SMS, since Twilio supports both.

What do you need for this tutorial?

You need a Twilio account, which you can create at www.twilio.com. You can use the free plan for starters, and you can upgrade later, if needed. After opening the account, activate the virtual number. This is where your users will see the SMSs as coming from.

You will also 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.

As mentioned earlier, 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.

In order for Zapier to be able to draw relevant information from your marketplace, you will need to have some activity there. In this tutorial, we will be setting up a Zap that sends an SMS message for each booking to the seller who owns the listing. It is enough that you have at least one recent transaction in your marketplace, so Zapier will be able to find that transaction event from your recent events. If there haven’t been any recent test transactions on your marketplace, go ahead and go do one now. This tutorial is built for a marketplace with a booking calendar, so if possible, do a transaction that includes a date booking.

You’ll also need to create an application using the Integration API. For the purposes of this tutorial, you don’t need to know details about using the APIs, but if you want, you can read about them from our technical documentation here.

Finally, the provider’s user account needs to have the phone number, so that Twilio knows where to send this information. Ideally, it is stored in the ‘Protected data’ of the user, in ‘String’ format. With the Extend plan, you can have a developer customize the users’ sign up process to include phone number collection, but you can also input it manually from Console. This is explained below.

With these pieces in place, let's get started!

Getting your Integration API key from Sharetribe Console

  1. Click on “+ Add a new application”

  2. Give the application a descriptive name (like Zapier), and select ‘Integration API’.

  3. Click ‘Add application’.

  4. Important: Copy and paste the Client ID and Client secret to a safe place, like a password manager.

    1. 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.

Entering a phone number in a user’s account

  1. Log in to your Console at https://console.sharetribe.com/

  2. Navigate to Manage > Users

  3. Click on the user you want to edit

  4. Find the ‘Protected’ data section, and click on ‘Edit’

  5. Click on ‘+ Add new field’ in the ‘Protected data’ section

  6. Write in a unique identifier key (such as ‘phone’)

  7. Choose ‘String’ as the data type (for technical reasons, this works better than ‘Number’)

  8. Enter the phone number in the ‘Value’ field that appears after you selected ‘String’ above. Note that the test text message will be sent to this number, so you should choose a number that you have access to (such as your own phone number).

  9. Click on the green ‘Save changes’ button at the bottom of the page

Creating the Zap, step by step

Importing a pre-existing Zap

  1. Go to www.zapier.com and log in with your account (or create a free one, if you don't already have one)

  2. Open the pre-made Zap for connecting Twilio to Sharetribe here

  3. Click on ‘Try this Zap'

Step 1: Find a recent transaction from your marketplace

  1. Connect your Sharetribe account by entering your Client ID and Client secret

  2. Click ‘Continue’ to move to the ‘Trigger’ section

  3. Choose ‘Transaction initiated’ as the ‘Event type’

  4. Click ‘Continue’ to move to the ‘Test’ section

  5. Test the trigger, and make sure it finds a recent transaction event with the relevant details (price and phone number, and date if applicable)

  6. Click ‘Continue with the selected record’ to move to the next step

Step 2: Retrieve the provider information

  1. Go to the ‘Action’ section, and click on the ‘User ID’ field

  2. Scroll down the ‘Transaction events’ list and find and choose ‘Transaction Provider Id’, and close the list

  3. Leave ‘Included relationships’ empty, and choose ‘No’ in the dropdown ‘Should this step be considered a “success” when nothing is found?’

  4. Click on ‘Continue’ to move to the ‘Test’ section

  5. Click on ‘Test step’ and make sure it finds the provider’s information, including their phone number

  6. Click ‘Continue’ to move to the next step

Step 3: Retrieve the listing information

  1. Go to the ‘Action’ section, and click on the ‘Listing ID’ field

  2. Scroll down the ‘Transaction events’ list and find and choose ‘Transaction Listing Id’, and close the list

  3. Again, leave the other two fields empty/default, and click ‘Continue’ to go to the ‘Test’ section

  4. Click ‘Test step’ and make sure the test finds the right listing, with its title and other relevant details

  5. Click ‘Continue’ to move to the next step

Step 4: Retrieve additional transaction information

  1. Go to the ‘Action’ section, and click on the ‘Transaction ID’ field

  2. Open the ‘Transaction events’ list and find and choose ‘Transaction Id’, and close the list

  3. In the ‘Included relationships’, choose ‘Booking’, ‘Customer’, and ‘Messages’

  4. Choose ‘No’ in the dropdown ‘Should this step be considered a “success” when nothing is found?’, and click ‘Continue’ to go to the ‘Test’ section

  5. Click ‘Test step’ and make sure the test find the right transaction, with its price and other relevant details, such as date

  6. Click ‘Continue’ to move to the next step

Step 5: Format the transaction price to currency units

Note: In this example, we assume the pricing is in Dollars. In the Sharetribe system, the price is displayed originally as a simple number without decimals, meaning that the price is in cents. Since people are used to seeing prices in full Dollars/Euros/etc., you’ll need to divide the original price by 100 to get the price in the ‘normal’ currency unit. If the currency your marketplace is using does not have cent equivalents at all, you may not need to perform this step at all.

  1. Go to the ‘Action’ section, and choose ‘Perform Math Operation’ in the ‘Transform’ field

  2. In the ‘Operation’ field, choose ‘Divide’

  3. In the ‘Input’ field, scroll down the ‘Transaction Events’ list and choose ‘Transaction Payin Total Amount’

  4. Close the list, and choose the field below, and enter 100

  5. Click ‘Continue’ to go to the ‘Test’ section

  6. Click ‘Test step’, and make sure that the output of the test is in full dollars/euros

  7. Click ‘Continue’ to move to the next step

Step 6: Format the transaction start date to a human readable format

  1. Go to the ‘Action’ section, and choose ‘Format’ in the ‘Transform’ field

  2. In the ‘Inputs’ field, choose ‘4. Show Transaction in Sharetribe’, and choose ‘Transaction Booking Start’

  3. In the ‘To Format’, choose your preferred date format (such as DD/MM/YYYY)

  4. Leave the other fields empty/default, and click ‘Continue’ to go to the ‘Test’ section

  5. Click on ‘Test step’, and make sure the ‘Output’ is in the date format you want your provider to see in the SMS message

  6. Click ‘Continue’ to move to the next step

Step 7: Format the transaction end date to a human readable format

  1. Go to the ‘Action’ section, and choose ‘Format’ in the ‘Transform’ field

  2. In the ‘Inputs’ field, choose ‘4. Show Transaction in Sharetribe’, and choose ‘Transaction Booking End

  3. In the ‘To Format’, choose your preferred date format (such as DD/MM/YYYY)

  4. Leave the other fields empty/default, and click ‘Continue’ to go to the ‘Test’ section

  5. Click on ‘Test step’, and make sure the ‘Output’ is in the date format you want your provider to see in the SMS message

  1. Click ‘Continue’ to move to the next step

Step 8: Construct the SMS message from the available data

  1. In the ‘Account’ section, Sign in with your Twilio account with the Account SID and Auth Token, which you can find from the ‘Live credentials’ section at: https://console.twilio.com/us1/account/keys-credentials/api-keys

  2. Click ‘Continue’ to go to the ‘Action’ section

  3. In the ‘From Number’, choose the standard number you activated when you created your Twilio account (if you didn’t, you can go activate one now)

  4. (Optional) Add an alphanumeric sender ID, if you want, such as "Biketribe". This will be displayed instead of the number if the receiving person's phone supports it

  5. In the ‘To Number’, open the “2. Show User in Sharetribe” list, and find “User Profile Protected Data Phone Number” (the last words may be different depending on what you chose as the key)

  6. In the ‘Message’ field, you can now write in the message you want your provider to receive, and include the information that you want. When constructing the message, you will need to select multiple different variables that are placed within the message. The message could be, for example:

“[3. Listing title] was just booked on Biketribe by [4. Transaction Customer Profile Display Name], from [6. Transaction Booking Start] until [7. Transaction Booking End], for $[5. Output] USD! Go to Biketribe at www.example.com to confirm the booking.”

This would translate to something like:

“Mountain bike was just booked on Biketribe by John, from 01/01/2024 until 01/05/2024, for $200 USD! Go to Biketribe at www.example.com to confirm the booking.”

6. Leave Media URL empty, and make your selection for ‘Send Large Messages’ based on how long you expect your messages to be. If your messages are over 160 characters and you choose ‘No’ here, the end of the message will be cut off.

7. Go to the ‘Test action’ and test the zap. If everything went well, you should now get a text message about the booking to the number associated with the transaction (ideally, you entered your own number here, so you can see the received message).

Final thoughts

Thanks for reading this tutorial about creating a Zap for your Sharetribe marketplace to send SMS confirmations to providers for new transactions via Twilio! Feel free to read through other parts of our Zapier guide as well: the Introduction and the article about Events and Actions. Also, there's a tutorial for a zap for the Mailchimp email service.

Please get in touch with us from 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!

Did this answer your question?