Install
openclaw skills install ms-graph-calendarFind available meeting times and free/busy slots for company employees using Microsoft Graph API. Use when user asks to schedule a meeting, find a free slot,...
openclaw skills install ms-graph-calendarUse this skill when the user wants to:
ถ้าผู้ใช้ยังไม่เคย setup หรือระบบแจ้งว่าขาด credentials ให้ทำดังนี้:
ถามผู้ใช้ 3 ค่านี้ทีละค่า:
เมื่อได้ครบแล้ว รันคำสั่ง:
node skills/ms-graph-calendar/scripts/setup.js \
--tenant-id <AZURE_TENANT_ID> \
--client-id <AZURE_CLIENT_ID> \
--client-secret <AZURE_CLIENT_SECRET>
ค่าจะถูกบันทึกไว้ที่ ~/.openclaw/ms-graph-calendar.json (permission 600) และจะถูกโหลดอัตโนมัติทุกครั้งที่ใช้ skill
node skills/ms-graph-calendar/scripts/get-token.js
ถ้าได้ "✅ Token acquired" แปลว่าพร้อมใช้งานแล้ว
App Registration ต้องมี Application Permissions:
Calendars.Read — read all users' calendarsUser.Read.All — list employeesAuthentication is cached after first login. No environment variables required for device code flow.
For headless/automated operation, set these environment variables:
This skill runs Node.js scripts via bash. Files:
scripts/ — Node.js scriptsnicknames.md — ตาราง mapping ชื่อเล่น → email (แก้ไขได้เลย)Before any Graph API call, get an app-only token:
node skills/ms-graph-calendar/scripts/get-token.js
Store the token in a temp variable for subsequent calls.
Extract from the user's message:
Asia/Bangkok if not specifiedIf any info is missing, ask the user before proceeding.
3a. ลองแปลงชื่อเล่นก่อน (เร็วกว่า ไม่ต้องเรียก API):
node skills/ms-graph-calendar/scripts/resolve-nicknames.js --names "แบงค์,มิ้ว,โบ้"
อ่านจาก nicknames.md ในโฟลเดอร์ skill — แก้ไขได้ตรงนั้นเลย
3b. ถ้าหาไม่เจอใน nicknames.md ให้ fallback ไปค้น Graph API:
node skills/ms-graph-calendar/scripts/list-users.js --search "ชื่อ"
Confirm กับ user ถ้ามีคนชื่อเดียวกันหลายคน
Method A — findMeetingTimes (best for small groups, ≤10 people):
node skills/ms-graph-calendar/scripts/find-meeting-times.js \
--attendees "alice@company.com,bob@company.com" \
--start "2025-03-01T08:00:00" \
--end "2025-03-01T18:00:00" \
--duration 60 \
--timezone "Asia/Bangkok" \
--max 5
Method B — getSchedule (best for large groups or viewing free/busy blocks):
node skills/ms-graph-calendar/scripts/get-schedule.js \
--emails "alice@company.com,bob@company.com,carol@company.com" \
--start "2025-03-01T00:00:00" \
--end "2025-03-07T00:00:00" \
--timezone "Asia/Bangkok" \
--interval 30
Format the available slots clearly:
📅 Available slots where everyone is free:
1. Monday 3 Mar · 10:00–11:00
2. Tuesday 4 Mar · 14:00–15:00
3. Wednesday 5 Mar · 09:00–10:00
Which slot works best?
If no slots are found, widen the search window and try again, or report that no common availability exists in that period.
User: "Find a 1-hour slot this week where Alice, Bob, and Carol are all free" Agent:
find-meeting-times.js with date range = this Mon–FriUser: "Is John free tomorrow afternoon?" Agent:
get-schedule.js for tomorrow 12:00–18:00User: "Show me everyone in the marketing team's availability next week" Agent:
list-users.js --group "Marketing"get-schedule.js for all their emails| Error | Cause | Fix |
|---|---|---|
401 Unauthorized | Token expired or wrong credentials | Re-run get-token.js, check env vars |
403 Forbidden | Missing Admin Consent | Ask IT admin to grant consent in Azure Portal |
404 Not Found | User email doesn't exist | Verify email via list-users.js |
| No slots found | Everyone is busy | Widen time range or reduce attendees |
Calendars.Read)New-ApplicationAccessPolicy -AppId <ClientId> -PolicyScopeGroupId <GroupId> -AccessRight RestrictAccess