Get a Daily Reminder of Your Upcoming Events Using the TBP API

In this tutorial, we will show you how you can send a daily reminder of your upcoming events to a Bot using The Bot Platform, Make(formerly Integromat) and The Bot Platform API.

Prior to completing this tutorial, you will need to run through the creating an API app and the generating a bearer token tutorials.

These tutorials MUST be completed in order for this tutorial to work:
https://dev.thebotplatform.com/docs/how-to-set-up-an-api-connection-to-the-bot-platform-using-oauth-20

https://dev.thebotplatform.com/docs/how-to-generate-a-bearer-token-in-integromat

1326

The first step is to create a new scenario in Make(formerly Integromat). Next, we need to select a Google Calendar, Search Events module as our trigger module.

Link your Google account to Make(formerly Integromat) by clicking on the add button. Once you have linked the two, you will see a list of all your available calendars when you select the drop down under calendar ID. Select your main calendar from the list. In the Start Date, use the ‘now’ option under date and time options. Because we are running this every day, we only want to see the events happening on the current day. So in the End Date, we want to use the addDays function and add one day to now. So the formula looks like this {{addDays(now; 1)}}

You calendar module should now look like this:

593

Next we need to add a Google Sheets Get a Cell module. This looks up the bearer token we created and stored in the previous tutorial.

Add in the cell reference for the bearer token you have created.

397

Next we need to add in a JSON create JSON module. Click add next to Data Structure and then click on generator. Paste in the following code.

{
	"data": {
		"attributes": {
			"messages": [{
				"text": "Hello"
			}, {
				"text": "World"
			}],
			"recipient": "[email protected]"
		},
		"type": "external - activity "
	}
}

Now click save and you will be presented with the following screen, but without any messages listed.

552

Add your email address into recipient and add ‘external-activity’ in the type field.

Now we want to go in and add in the message. Click Add item under messages. You can format this how you want, but in this instance we want our message to say:

Events Today : Meeting Summary - 9:00 to 1:00
So we have used the above formula to represent this. It uses the information pulled through from our Get Events module in the first step.

Ultimately, when sent to a bot, it looks as follows:

409

Finally, we need to add in a HTTP ‘Make a request module’. This is how we pass the information through to The Bot Platform.

In the URL field, you want to add the URL https://api.thebotplatform.com/v1.0/activity/external

Our method needs to be POST.

Now we need to add some headers. Click on the edit and add two headers as follows:

Accept with a value of application/json

Authorization with a value of Bearer “value” For the value, you should use the find a cell from the second step.

You then want to change the body type to Raw and the content type to JSON (application/JSON)

In your request field, you want to use the JSON you created in the previous step.

671

Finally, we want to set up how often this scenario runs. Click on the clock icon at the bottom left. In here you can customise how often you want your notifications.

For this bot, we have set it to run every weekday at 7.30 as shown below.

399

Now we turn our scenario on and it is ready to go.