الأكاديمية ← تشغيل Hermes يوميًاتوثيق رسمي · إرشاد عربي

ربط Google Workspace: Gmail والتقويم وDrive

Google Workspace — Gmail, Calendar, Drive, Sheets & Docs

متوسط5 دقائق قراءةالدرس 54 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

Skill: ملف تعليمات يعلّم Hermes طريقة إنجاز مهمة معيّنة، مثل ورقة إرشادات يفتحها عند الحاجة. تكتب الطريقة مرة واحدة، فيكرّرها Hermes بنفس الجودة كل مرة بدل أن تشرحها من جديد في كل محادثة. الصفحة فيها تحذير من المصدر، و5 دقائق قراءة. انتبه: المهارة نص يقرأه الوكيل ويطيعه. اقرأ محتواها قبل تفعيلها، فهي تستطيع توجيهه لأشياء لم تقصدها.

9أقسام
12أمثلة برمجية
2جداول
0أوامر
770كلمة من المصدر
الوصف الرسمي في سطر

Send email, manage calendar events, search Drive, read/write Sheets, and access Docs — all through OAuth2-authenticated Google APIs

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما Skill ولماذا قد تحتاجه.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تضبط MESSAGE_ID في المكان الصحيح.
  • تتجنّب الخطأ الذي يحذّر منه المصدر.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

متغيرات البيئة
  • MESSAGE_ID
  • LABEL_ID
  • EVENT_ID
  • SHEET_ID
  • DOC_ID
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Setup
  2. 02Gmail
  3. 03Calendar
  4. 04Drive
  5. 05Sheets
  6. 06Docs
  7. 07Contacts
  8. 08Output Format
  9. 09Troubleshooting
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

Gmail, Calendar, Drive, Contacts, Sheets, and Docs integration for Hermes. Uses OAuth2 with automatic token refresh. Prefers the Google Workspace CLI (gws) ↗ when available for broader coverage, and falls back to Google's Python client libraries otherwise.

Skill path: skills/productivity/google-workspace/

Setup

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية.

The setup is fully agent-driven — ask Hermes to set up Google Workspace and it walks you through each step. The flow:

  1. Create a Google Cloud project and enable the required APIs (Gmail, Calendar, Drive, Sheets, Docs, People)
  2. Create OAuth 2.0 credentials (Desktop app type) and download the client secret JSON
  3. Authorize — Hermes generates an auth URL, you approve in the browser, paste back the redirect URL
  4. Done — token auto-refreshes from that point on

Gmail

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط MESSAGE_ID، LABEL_ID خارج المحادثة، في بيئة التشغيل.

Searching

Shell3 أسطر
$GAPI gmail search "is:unread" --max 10
$GAPI gmail search "from:boss@company.com newer_than:1d"
$GAPI gmail search "has:attachment filename:pdf newer_than:7d"

Returns JSON with id, from, subject, date, snippet, and labels for each message.

Reading

Shellسطر واحد
$GAPI gmail get MESSAGE_ID

Returns the full message body as text (prefers plain text, falls back to HTML).

Sending

Shell14 سطرًا
# Basic send
$GAPI gmail send --to user@example.com --subject "Hello" --body "Message text"

# HTML email
$GAPI gmail send --to user@example.com --subject "Report" \
  --body "<h1>Q4 Results</h1><p>Details here</p>" --html

# Custom From header (display name + email)
$GAPI gmail send --to user@example.com --subject "Hello" \
  --from '"Research Agent" <user@example.com>' --body "Message text"

# With CC
$GAPI gmail send --to user@example.com --cc "team@example.com" \
  --subject "Update" --body "FYI"

Custom From Header

The --from flag lets you customize the sender display name on outgoing emails. This is useful when multiple agents share the same Gmail account but you want recipients to see different names:

Shell7 أسطر
# Agent 1
$GAPI gmail send --to client@co.com --subject "Research Summary" \
  --from '"Research Agent" <shared@company.com>' --body "..."

# Agent 2  
$GAPI gmail send --to client@co.com --subject "Code Review" \
  --from '"Code Assistant" <shared@company.com>' --body "..."

How it works: The --from value is set as the RFC 5322 From header on the MIME message. Gmail allows customizing the display name on your own authenticated email address without any additional configuration. Recipients see the custom display name (e.g. "Research Agent") while the email address stays the same.

Important: If you use a different email address in --from (not the authenticated account), Gmail requires that address to be configured as a Send As alias ↗ in Gmail Settings → Accounts → Send mail as.

The --from flag works on both send and reply:

Shellسطران
$GAPI gmail reply MESSAGE_ID \
  --from '"Support Bot" <shared@company.com>' --body "We're on it"

Replying

Shellسطر واحد
$GAPI gmail reply MESSAGE_ID --body "Thanks, that works for me."

Automatically threads the reply (sets In-Reply-To and References headers) and uses the original message's thread ID.

Labels

Shell6 أسطر
# List all labels
$GAPI gmail labels

# Add/remove labels
$GAPI gmail modify MESSAGE_ID --add-labels LABEL_ID
$GAPI gmail modify MESSAGE_ID --remove-labels UNREAD

Calendar

فيه تحذير مهم. اقرأه قبل أن تنفّذ أي شيء من هذا القسم. نصّ التحذير من المصدر مذكور أسفل هذا الشرح.

Shell15 سطرًا
# List events (defaults to next 7 days)
$GAPI calendar list
$GAPI calendar list --start 2026-03-01T00:00:00Z --end 2026-03-07T23:59:59Z

# Create event (timezone required)
$GAPI calendar create --summary "Team Standup" \
  --start 2026-03-01T10:00:00-07:00 --end 2026-03-01T10:30:00-07:00

# With location and attendees
$GAPI calendar create --summary "Lunch" \
  --start 2026-03-01T12:00:00Z --end 2026-03-01T13:00:00Z \
  --location "Cafe" --attendees "alice@co.com,bob@co.com"

# Delete event
$GAPI calendar delete EVENT_ID

Drive

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: ملف تعليمات يعلّم Hermes طريقة إنجاز مهمة معيّنة، مثل ورقة إرشادات يفتحها عند الحاجة.

Shellسطران
$GAPI drive search "quarterly report" --max 10
$GAPI drive search "mimeType='application/pdf'" --raw-query --max 5

Sheets

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط SHEET_ID خارج المحادثة، في بيئة التشغيل.

Shell8 أسطر
# Read a range
$GAPI sheets get SHEET_ID "Sheet1!A1:D10"

# Write to a range
$GAPI sheets update SHEET_ID "Sheet1!A1:B2" --values '[["Name","Score"],["Alice","95"]]'

# Append rows
$GAPI sheets append SHEET_ID "Sheet1!A:C" --values '[["new","row","data"]]'

Docs

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط DOC_ID خارج المحادثة، في بيئة التشغيل.

Shellسطر واحد
$GAPI docs get DOC_ID

Returns the document title and full text content.

Contacts

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Shellسطر واحد
$GAPI contacts list --max 20

Output Format

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.

All commands return JSON. Key fields per service:

CommandFields
gmail searchid, threadId, from, to, subject, date, snippet, labels
gmail getid, threadId, from, to, subject, date, labels, body
gmail send/replystatus, id, threadId
calendar listid, summary, start, end, location, description, htmlLink
calendar createstatus, id, summary, htmlLink
drive searchid, name, mimeType, modifiedTime, webViewLink
contacts listname, emails, phones
sheets get2D array of cell values

Troubleshooting

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا.

ProblemFix
NOT_AUTHENTICATEDRun setup (ask Hermes to set up Google Workspace)
REFRESH_FAILEDToken revoked — re-run authorization steps
HttpError 403: Insufficient PermissionMissing scope — revoke and re-authorize with the right services
HttpError 403: Access Not ConfiguredAPI not enabled in Google Cloud Console
ModuleNotFoundErrorRun setup script with --install-deps
اختبار الفهم

4 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. في جدول هذا الدرس، ما «Fields» المقابل لـ«calendar create»؟
2. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
3. ما التحذير الذي يذكره المصدر في هذا الدرس؟
4. أي عنوان من التالي لا يظهر في هذا الدرس؟