Wednesday, November 9, 2016

Connecting your bot to Google Calendar

Bots can do more than just chat. They can book appointments, service calls, meetings, send emails, and SMS messages.

Bot Libre has support for connecting your bot to Google Calendar to access your schedule and book appointments. To connect your bot to Google Calendar go to your bot's "Google" page in its "Admin Console".

To get to your bot's Admin Console click on the button below its "Chat" button on its page.

Next, click on the Google tab.

Click on the Authorize button to connect your bot.

This will give you a link to Google. Click on the link and accept the authorization request.

You will need to login to your Google account. If you want the bot to have its own Calendar you can create a separate Google account. If you do not have a Google account or Calendar you can create one first here.

After you accept the request Google will give you a code.

Copy this code and go back to the Bot Libre page and paste it in the text field.

Click "Done".

Your bot is now connect to your Google Calendar and has permission to access it.

You can use the GoogleCalendar class from a Self script to access your calendar.

The GoogleCalendar class has functions like getEvents(from, to), insertEvent(event), and deleteEvent(event). The event objects are Self objects that match Google Calendars JSON format. You can also call requestJSON(url), or postJSON(url, json) to call any Google Calendar web API. For more information of Google Calendars web API see Google's API reference.

If writing your own script seems too complicated, you can also import existing Calendar scripts from our script library.

In your bot's Admin Console go to its "Scripts" page.

On your bot's Scripts page there is a blue "Import" button on the right toolbar.

Click on this button to import scripts into your bot.

This will give you a lot of scripts to choose from, filter them but typing "calendar" in Tags and "Self" in Language.

Select the "Book Appointment" script and import it.

This script gives your bot the "book" and "cancel" commands that lets a user book appointments to your calendar.

For an example, talk to the Scheduler Bot, or create your own scheduler bot using the scheduler_template.

No comments:

Post a Comment