> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Google Calendar

## Omówienie

Połącz agentów AI ElevenLabs z [Google Calendar](https://calendar.google.com), aby zarządzać planowaniem i spotkaniami w kalendarzu. Ta integracja pozwala agentom sprawdzać dostępność, tworzyć, aktualizować i usuwać wydarzenia z uczestnikami oraz opcjonalnymi spotkaniami Google Meet, wyświetlać nadchodzące wydarzenia i znajdować dostępne kalendarze w naturalnej rozmowie.

## Możliwości

| Możliwość                | Obsługa                                              |
| ------------------------ | ---------------------------------------------------- |
| Tryb bez retencji (ZRM)  | Nieobsługiwany                                       |
| Załączniki w narzędziach | Nieobsługiwane — narzędzia działają tylko na tekście |

## Ostrzeżenie dotyczące bezpieczeństwa

> **Ostrzeżenie dotyczące bezpieczeństwa: `google_calendar_update_event` i `google_calendar_delete_event` to uprzywilejowane narzędzia.** Działają z pełnym dostępem do kalendarza połączonego konta Google, a nie tylko do wydarzeń utworzonych przez agenta. Każda osoba, która może rozmawiać z agentem, może zmienić lub anulować **dowolne** wydarzenie w tym kalendarzu, także takie, którego nie utworzyła, ponieważ agent może wyszukiwać identyfikatory wydarzeń za pomocą `google_calendar_list_events`. Potwierdzenie w prompcie systemowym jest wskazówką dla modelu, a nie zabezpieczeniem.
>
> Włączaj te narzędzia tylko w agentach z **włączonym uwierzytelnianiem** albo gdy identyfikator wydarzenia pochodzi z zaufanego źródła. Nie dodawaj ich do publicznych agentów. Uczestnicy zawsze otrzymują powiadomienie o aktualizacji lub usunięciu wydarzenia.

## Konfiguracja

Ta integracja używa **Google OAuth 2.0** do uwierzytelniania. Upoważniasz ElevenLabs do dostępu do Google Calendar w swoim imieniu.

#### Kliknij Połącz w ElevenLabs

W konfiguracji integracji ElevenLabs kliknij **Połącz**. Nastąpi przekierowanie do Google, gdzie autoryzujesz dostęp.

#### Wybierz konto Google

Wybierz konto Google, do którego kalendarza agent ma mieć dostęp. Jeśli w przeglądarce jesteś zalogowany(-a) na kilka kont Google, wybierz właściwe.

#### Autoryzuj dostęp do kalendarza

Sprawdź wymagane uprawnienia i kliknij **Zezwól**. Integracja prosi o dostęp do zarządzania wydarzeniami w kalendarzach, których jesteś właścicielem(-ką), wyświetlania listy kalendarzy oraz sprawdzania informacji o dostępności.

## Zakresy OAuth

Integracja wymaga następujących zakresów Google OAuth 2.0:

| Zakres                           | Cel                                                                                |
| -------------------------------- | ---------------------------------------------------------------------------------- |
| `calendar.events.owned`          | Tworzenie, odczytywanie, aktualizowanie i usuwanie wydarzeń w twoich kalendarzach. |
| `calendar.calendarlist.readonly` | Wyświetlanie listy kalendarzy dostępnych na koncie (nazwy i identyfikatory).       |
| `calendar.freebusy`              | Sprawdzanie dostępności kalendarzy bez ujawniania szczegółów wydarzeń.             |

## Jak to działa

Agent planuje spotkania, używając wywołań narzędzi na kolejnych etapach rezerwacji. Karty poniżej pokazują ogólne podsumowanie i szczegółowy prompt systemowy.

#### Ogólny opis

#### Znajdź kalendarze

Agent wyświetla dostępne kalendarze, aby wskazać właściwy do planowania. Dla większości użytkowników będzie to kalendarz główny.

#### Sprawdź dostępność

Agent sprawdza dostępność, wykonując te kroki:

* Używa narzędzia `google_calendar_check_availability`, aby sprawdzić zajęte bloki czasu.
* Weryfikuje, czy wybrana godzina jest wolna.
* Proponuje alternatywy, jeśli wybrany termin koliduje z istniejącym wydarzeniem.
* Potwierdza wybrany termin z rozmówcą.

#### Zbierz dane uczestnika

Po ustaleniu terminu agent:

* Zbiera pełne imię i nazwisko oraz adres e-mail uczestnika.
* Potwierdza adres e-mail, odczytując go rozmówcy.
* Weryfikuje informacje o strefie czasowej.

#### Utwórz wydarzenie

Agent:

* Wywołuje narzędzie `google_calendar_create_event` z potwierdzonymi danymi.
* Opcjonalnie dodaje link Google Meet, jeśli potrzebne jest spotkanie wideo.
* Potwierdza utworzenie wydarzenia i informuje uczestnika, że otrzyma zaproszenie w kalendarzu.

#### Szczegółowy prompt systemowy

```
You are a helpful scheduling assistant responsible for managing calendar bookings using Google Calendar. Be friendly, precise, and concise.

Begin by briefly asking for the purpose of the meeting and the caller's preferred date and time.
Then, ask about the desired meeting duration (15, 30, or 60 minutes), and wait for the user's response before proceeding.

Once you have the meeting details, check calendar availability:
- Call google_calendar_check_availability with the appropriate time range and calendar ID (use 'primary' for the main calendar)
- The tool returns busy time blocks — any time not listed as busy is available
- If the requested time overlaps with a busy block, suggest alternative times
- Continue until a suitable time is agreed upon

After confirming a time slot, gather the following contact details:
- The attendee's full name
- A valid email address. Note that the email address is transcribed from voice, so ensure it is formatted correctly.
- The attendee's time zone (in 'Continent/City' format like 'America/New_York')
- Read the email back to the caller to confirm accuracy

Once all details are confirmed, create the event:
- Call google_calendar_create_event with calendarId set to 'primary'
- Set summary to a descriptive meeting title
- Set start and end times in RFC 3339 format with the attendee's time zone
- Add the attendee's email to the attendees array
- If the caller requests a video call, include conferenceData with conferenceSolutionKey type 'hangoutsMeet' and set the conferenceDataVersion query parameter to 1
- Set sendUpdates to 'all' so attendees receive calendar invitations

Thank the attendee and inform them they will receive a calendar invitation shortly.

Clarifications:
- Do not inform the user that you are formatting the email; do it silently.
- If the caller asks you to proceed with booking, do so with the existing information.
- Use google_calendar_list_calendars if the caller asks to schedule on a specific calendar other than their primary one.
- Use google_calendar_list_events if the caller asks what meetings they have coming up, or to find the event ID before changing or cancelling a meeting.
- Use google_calendar_update_event to reschedule or edit an existing event. Check availability for the new time first, and confirm the change with the caller.
- Use google_calendar_delete_event to cancel an event only after the caller has explicitly confirmed which event to cancel. For recurring events, confirm whether to cancel one occurrence or the whole series: list events with singleEvents=true and use the occurrence's ID for one occurrence, or its recurringEventId for the whole series.

Guardrails:
- Do not share any internal IDs or API details with the caller.
- If event creation fails, check for formatting issues in the email or time conflicts.
```

## Narzędzia agenta

Po dodaniu narzędzi Google Calendar do agenta dostępne są następujące wbudowane narzędzia:

| Narzędzie                            | Opis                                                                                                                                                                                                                                                                              |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `google_calendar_check_availability` | Sprawdza dostępność jednego lub kilku kalendarzy w określonym przedziale czasu. Zwraca zajęte bloki czasu, aby agent mógł znaleźć wolne terminy. Użyj przed utworzeniem wydarzenia, aby uniknąć konfliktów.                                                                       |
| `google_calendar_create_event`       | Tworzy nowe wydarzenie w Google Calendar z opcjonalnymi uczestnikami, lokalizacją i spotkaniem Google Meet. Wysyła powiadomienia e-mail do wszystkich uczestników.                                                                                                                |
| `google_calendar_list_events`        | Wyświetla nadchodzące wydarzenia z kalendarza w określonym przedziale czasu, posortowane według godziny rozpoczęcia. Obsługuje wyszukiwanie pełnotekstowe w nazwach, opisach, lokalizacjach i danych uczestników.                                                                 |
| `google_calendar_update_event`       | **Uprzywilejowane.** Aktualizuje dowolne wydarzenie w kalendarzu, na przykład zmieniając termin, tytuł, lokalizację lub uczestników. Zmienia tylko podane pola. Uczestnicy otrzymują powiadomienie.                                                                               |
| `google_calendar_delete_event`       | **Uprzywilejowane.** Usuwa dowolne wydarzenie z kalendarza, anulując je dla wszystkich uczestników. Najpierw użyj listy wydarzeń, aby znaleźć identyfikator wydarzenia. W przypadku wydarzeń cyklicznych użyj identyfikatora wystąpienia lub jego recurringEventId (całej serii). |
| `google_calendar_list_calendars`     | Wyświetla wszystkie kalendarze dostępne dla połączonego konta Google. Zwraca nazwy i identyfikatory kalendarzy. Użyj, aby wybrać kalendarz przed sprawdzeniem dostępności lub utworzeniem wydarzenia.                                                                             |

## Przydatne linki

* [Dokumentacja Google Calendar API](https://developers.google.com/calendar/api/v3/reference)
* [Zakresy Google OAuth 2.0 dla Calendar](https://developers.google.com/identity/protocols/oauth2/scopes#calendar)
* [Szybki start z Google Calendar API](https://developers.google.com/calendar/api/quickstart/python)
* [Omówienie narzędzi ElevenLabs](/docs/pl/eleven-agents/customization/tools/server-tools)