Advanced Beginner 45 min

OpenClaw実践:メール仕分けと毎朝のブリーフィング

デプロイ済みのOpenClawにGmailを接続し、ルールに沿ってメールに自動でラベルを付け、未読をまとめさせます。さらにcronで毎朝8時にカレンダー・メール要約・タスクを朝のブリーフィングとして届けます。未デプロイの方は /tutorials/deploy-local/ を、OpenClawの概要は /office-agents/openclaw/ を参照してください。

#業務自動化#OpenClaw#メール

前提条件

  • A deployed OpenClaw instance (see the /tutorials/deploy-local/ tutorial)
  • A Gmail account
  • A configured model API key

ステップ

1

Gmailアカウントを連携

OpenClawにはGmailのネイティブ連携が組み込まれており、受信トレイの読み取り・下書き・管理ができます。管理画面から接続を開始し、案内に従ってGoogleのOAuth認可を完了してください。

ヒント

  • For the first connection, use a test mailbox and switch to your primary one only after the behavior checks out
  • If authorization fails, first confirm your deployment can reach Google services
2

SOUL.mdに安全ガードレールを書く

SOUL.mdはOpenClawの人格とルールを定義するファイルです。ここに「メール送信は必ず下書きを先に出し、人の確認を待ってから送る」という厳格なルールを追加しましょう。コミュニティで定番の運用で、誤送信の防止に効きます。

ヒント

  • The more specific the rule, the more reliable — e.g., 'Never send, reply to, or forward any email without my confirmation'
  • After editing, ask OpenClaw to recite the rule to confirm it stuck
3

メール仕分けルールを設定

メールの分類方法を自然言語でOpenClawに伝えます。差出人や件名で自動ラベル付けをさせ、未読を短いサマリーにまとめさせましょう。コードは不要です。

ヒント

  • Start with just a few labels (e.g., 'clients', 'bills', 'notifications') — far easier to maintain than a dozen categories on day one
  • When a message is mislabeled, tell OpenClaw the correct answer and let it adjust the rules
4

毎朝8時のブリーフィングを設定

cronの定期タスクを作成し、OpenClawに毎朝8時で当日のカレンダー、メール要約、タスクをまとめさせ、WhatsAppかTelegramに届けさせましょう。

ヒント

  • Have the briefing follow a fixed template so you can scan it at a glance
  • Add a failure notification to the cron job so a missed briefing surfaces immediately
5

使用量上限を設定してAPIコストを制御

メール仕分けや毎朝のブリーフィングはモデル呼び出しを継続的に消費するため、必ずOpenClawで使用量上限を設定しましょう。上限なしでコストが暴走した実例(「$120 disaster」と呼ばれた件)がコミュニティで報告されています。

ヒント

  • Set the cap low first, watch real usage for a week or two, then raise it gradually
  • Also set a hard spending limit at your model provider as a last line of defense
6

段階的に拡大:まず下書きから、その後自動化

最初の1週間はOpenClawが作る下書きの品質を確認し、1通ずつ人手でチェックします。下書きの精度が安定してから、自動ラベル付けや自動アーカイブなど低リスクな操作へ段階的に広げましょう。

ヒント

  • Enable actions one at a time in this order: labeling → archiving → drafting replies, observing each for a few days
  • Keep human confirmation on anything that sends email externally — permanently

よくある問題

Gmailの認可に失敗する場合は?
まずデプロイ環境からGoogleサービスにアクセスできるか、正しいGoogleアカウントでログインしているかを確認してください。繰り返し失敗する場合は、Googleアカウントのセキュリティ設定でアプリの認可を取り消し、再度OAuth認可を行いましょう。
APIコストが想定を超えた?
自動化タスクが高頻度でモデルを呼んでいないか確認し、不要なタスクを停止してください。その上でOpenClawに使用量上限を、プロバイダー側に支出の上限を設定しましょう。
ブリーフィングの配信時刻がずれる?
cronはデプロイ環境のシステムタイムゾーンで動くため、手元の時間とずれることがあります。サーバーのタイムゾーンを確認し、必要なら自分のタイムゾーン(例:Asia/Shanghai)に設定してからタスクを保存し直してください。