Table of Contents

How to list events from Google Calendar using Paragon

Alexander Gao Updated by Alexander Gao

Introduction

In some occasions we might need to list and show the users the events we have in Google Calendar, in this article we will show you how to do it.

In this case, Paragon can help you to send the information collected, here weโ€™re going to give you the steps to do it:

  • 1. Prepare the Automation trigger in Landbot that will trigger the automation with the information needed
  • 2. Set up Paragon workflow to request external information using the information sent from Landbot
  • 3. Introduce the data collected and using Google Calendar as an action
  • 4. Introduce the timestamp(https://www.unixtimestamp.com/) of the date interval that you want the events to be shown
  • 5. Use the data collected from Paragon and using Landbot API, create a variable in Landbot with that values we collected
  • 6. Resume the event flow from a specific block using Landbot API
  • 7. Extract the event from the variable we created before to be used after

Prepare Landbot
  1. Firstly, we can set a button block to ask if the user want to know the events.

  1. Then let's set a Trigger automation block.

  1. Then create a Dynamic data block:

  1. Now let's set up Dynamic data to show the events we had, and save array index for the following steps:

  1. Then set 3 formulas blocks, with
    GetValue(@event,@index,"summary") 
    GetValue(@events,@index,"creator","email")
    GetValue(@events,@index,"start","dateTime")
    inside of each other.
  2. In the final step, we just need to set a message block, to show the information we get from Google Calendar:

Create Paragon workflow
  1. After set a Trigger automation block, let's open Paragon, and log in:

  1. Then click on the button of New Workflow at upper right corner:

  1. Let's give it a description, or a name:

  1. Click on the button of Create:

  1. It shows this page:

  1. Then below Select a trigger we select API Endpoint:
  1. After that, below How do you want to define test data for this step we choose Detect parameters by sending a test request:
  1. Now copy the URL:
Prepare Landbot request to Paragon
  1. During the time it waits for the datas, let's open Landbot, then paste the URL to Trigger automation block:

Please pay attention to test-endpoint behind of URL, if you just want to test the trigger you may keep it. But if you want to test the whole workflow after add more actions, it's better to delete it, so you can get the right response.
  1. Then let's go to https://www.unixtimestamp.com/, to get current time stamp:

  1. Now we are going to the variables we want to send to Paragon, then scroll down and go to Set data (variables) to be sent, where you can see we are setting values to the Landbot variables:
Here to make the whole flow for we can insert the data from Paragon, we only have to send the customer ID, if just for testing, we can type in a random number
  1. And click on Test webhook trigger button:
  1. If you scroll down, you will see the response from Paragon:

  1. As long as the status code is 200, means our request is successfully sent.

Inside of Paragon check request data
  1. Now we turn back to Paragon:

Now we have seen in the body there is a code with the information we sent. Means Paragon has received our variables.

Yes, @id the same as we sent to Paragon: This is how the trigger works, we send variables to Paragon, they receive, and when we try to test it as we did in step 14, it will be shown.

So until here the trigger of Paragon is done.

Set Google Calendar as an action

  1. Click on the button of Plus to add another action:

  1. Then select Google Calendar:

  1. After that, we have to connect our google account, then choose List events as the action, finally we choose the calendar which includes the events we want to show:

  1. Then let's go to Unix timestamp, to get the timestamp of the date we want to intercept:
  1. Copy the Unix timestamp, paste it to the bar of After:

  1. Now let's click on the button of Test Step:

  1. As we can see, the event is displayed here:

Set up the actions through Paragon: CustomerFields - Create

Set action event and method
  1. Now let's move the mouse to the button of plus and click on it:

  1. Then let's choose Request as an action:
  1. Change the method to Post:
Get Landbot API URL
  1. Now let's open the documentation of Landbot API:

  1. Copy the URL of API:

  1. Then turn back to Paragon and paste it to the URL:
Insert the customer ID and adapt variable name
  1. Go to Paragon, replace :customer_id with the ID we sent:
To add variables to actions, we have to add {{}}, then the variables will be displayed to select
  1. And after that, replace :field_name with event:
Get API token and set headers in Paragon
  1. Now let's turn to Landbot to get the token, by clicking on the avatar > account, scroll down, in the API token:

  1. Copy it:
  1. Go to Paragon, below the header we type in Authorization, and behind Authorization we type in Token XXXXXXXXXXXXXXXXXX

(You can also check at the top of the Landbot API documentation, at General )

  1. Then click on Add another:

  1. Type in Content-Type and behind it let's type in application/json:

Set the body type and request content
  1. Select Raw as the body type:
  1. Now let's set the Request content with this JSON code:
{ 
"type": "object",
"value":

}

  1. Then we complete the code with the data we collected in Google Calendar:
It's better to choose result.items as the data in the value, in order to simplify the following steps

Set up the actions through Paragon: Customers - Assign bot

Set action event and method
  1. Now let's set another Request:
  1. In the method, we select Put this time:
Get Landbot API URL
  1. Then let's go to the Landbot API documentation, and go to Assign Bot:

  1. Then copy the URL:
  1. Then turn back to Paragon, and paste it:
Set the customer ID and Bot ID in the URL
  1. Then replace :customer_id with the number we got from the trigger:
  1. To get the bot ID let's open Landbot builder, and find its URL:
  1. Copy the number before builder:
  1. Turn back to Paragon, and replace :bot_id with it:

Get API token and set headers in Paragon
  1. Now let's turn to Landbot to get the token, by clicking on the avatar > account, scroll down, in the API token:

  1. Copy it:

  1. Go to Paragon, below header we type in Authorization, and behind Authorization we type in:

Authorization Token XXXXXXXXXXXXXXXXXX

(You can also check at the top of Landbot API documentation, at General )

  1. Then click on Add another:

  1. Type in Content-Type and behind it let's type in application/json:

Set the body type and request content
  1. Turn back to API documentation, copy the body (there's a body we actually need below):
{ "launch": true,
"node": "XXXXXXXX"
}
  1. Inside of body type we choose RAW:
  1. Then paste the code to the body:

  1. To get the node, let's open Landbot, and click the Dynamic Data block with right click, press copy reference:
  1. Then back to Paragon, replace the code after node with it:

The whole workflow, it should be like this:

  1. Now let's click on the button of Deploy at the upper right corner:

Test the flow

  1. The whole flow should work like this:

Yes, the information we sent before appears, the action is completed!

How did we do?

Paragon trigger

Contact