Files
hats-app/google-calendar.md
Ichsan Kurniawan cf9e36f10a Add Google Calendar events and tasks
Add calendar authentication and event/task actions, plus rich-description styling and setup documentation.
2026-11-17 21:24:30 +07:00

25 lines
1.6 KiB
Markdown

Langkah 1: Google Cloud Console
- Buka Google Cloud Console
- Buat project baru (misal: hats-project) atau pilih project yang sudah ada.
- Masuk ke APIs & Services > Library, cari Google Calendar API, lalu klik Enable.
- Buat OAuth 2.0 Client ID (Web Application) di Google Cloud Console.
- Tambah pada bagian Authorized redirect URIs: `https://developers.google.com/oauthplayground`
Langkah 2: Google Playground
Buka Google OAuth 2.0 Playground
- Klik ikon Gear (⚙️ OAuth 2.0 configuration) di pojok kanan atas:
- Centang kotak "Use your own OAuth credentials".
- Masukkan nilai GOOGLE_CLIENT_ID dan GOOGLE_CLIENT_SECRET Anda.
- Klik Close.
- Pada panel kiri (Step 1), masukkan scope: `https://www.googleapis.com/auth/calendar`
- Lalu klik Authorize APIs dan login menggunakan akun Google sistem Anda (his.nutech@gmail.com).
- Pada Step 2, klik tombol Exchange authorization code for tokens.
- Salin Refresh token yang baru dihasilkan, lalu ganti nilai GOOGLE_REFRESH_TOKEN di .env.development dan restart server Next.js (npm run dev).
Langkah 3: Buka Google Calendar dengan akun Google pengelola.
- Buat kalender khusus (misal: "HATS Tasks & Schedule") atau gunakan kalender yang sudah ada.
- Klik ikon titik tiga di samping kalender > Settings and sharing.
- Gulir ke bagian Share with specific people or groups, klik Add people and groups.
- Tempelkan email Service Account Anda (format: hats-calendar-bot@<project-id>.iam.gserviceaccount.com).
- Atur izin menjadi: "Make changes to events" (agar bot bisa membuat, mengedit, dan menghapus event).
- Gulir ke bagian Integrate calendar, lalu salin Calendar ID (format: xxx@group.calendar.google.com atau alamat email pemilik).