💾 Archived View for gmi.bacardi55.io › blog › 2017 › 01 › 09 › kalliope-neuron-for-google-calendar captured on 2023-07-22 at 16:47:31. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Posted on 2017-01-09
Even though I'm not a big fan of using Google (or any GAFAM) products, I must use this one for managing some of my meetings.
So, I worked and published a neuron that allows Kalliope[1] to talk to google calendar so that kalliope can tell me what are my next meetings. The idea of the neuron is very simple and only work on read only.
1: https://github.com/kalliope-project/kalliope
First, you need to create an app in your google developer console[2] and allow the google calendar API. For this you can go directly via this wizzard[3]
2: https://console.developers.google.com
3: https://console.developers.google.com/flows/enableapi?apiid=calendar&authuser=1&pli=1
or follow the step 1 of this tutorial
Copy / pasting the relative steps here:
As any other neurons, just do
kalliope install --git-url https://github.com:bacardi55/kalliope-google-calendar.git
And now, you need to configure the neuron to make it works. The way I'm doing it, is:
mkdir /home/pi/.google_calendar mv /home/pi/client_secret.json ~/.google_calendar/
--- - name: "Google-agenda-next" signals: - order: "what are my next meetings" neurons: - google_calendar: credentials_file: "/home/pi/.google_calendar/credentials.json" client_secret_file: "/home/pi/.google_calendar/client_secret.json" scopes: "https://www.googleapis.com/auth/calendar.readonly" application_name: "App name" max_results: 3 locale: fr_FR.UTF-8 # needs to be an installed locale file_template: "templates/fr_google_calendar.j2"
Remember to update the path if they are not the same and the application name as well. Your local needs to be installed as well on your system. And write your own template :)
Here is my example:
{% raw %} {% if count > 0 %} Your next meetings are {% for event in events %} on {{ event['time']['weekday'] }}, {{ event['time']['day'] }}, {{ event['time']['month'] }}, à {{ event['time']['hour'] }} hour, {{ event['time']['minute'] }} : {{ event['summary'] }} {% endfor %} {% else %} You don't have any meeting coming up {% endif %} {% endraw %}
Neuron is read only so you can't create calendar events from this neuron, but I'm always happy to integrate pull requests :)