Notificationコネクタ
Notificationコネクタは、ペイロードをメッセージとして外部チャネルに配信します。メッセージ本文は、JSONマーシャル化されたペイロード、またはGoのtext/templateからレンダリングされた文字列のいずれかです。
コネクタタイプ: MeddleNotification
サポートされているチャネル: slack、teams、email、microsoft365、webhook
設定パラメータ
Section titled “設定パラメータ”- channel(必須):
slack、teams、email、microsoft365、webhookのいずれか - template: オプションのGo
text/template文字列。ペイロードフィールドは{{ .field }}としてアクセス可能。空の場合、ペイロードはJSONエンコードされます。 - webhookUrl: ターゲットURL(
webhookチャネルで使用) - slackConfig: Slack固有のオプション
- teamsConfig: Teams固有のオプション
- emailConfig: SMTPメールオプション
- microsoft365Config: Microsoft Graph APIオプション
{ "type": "MeddleNotification", "config": { "channel": "slack", "template": "Temperature alert: {{ .temperature }}°C on sensor {{ .sensor_id }}", "slackConfig": { "botToken": "xoxb-...", "channel": "#alerts" } }}slackConfigフィールド:
- botToken(必須):SlackボットユーザーOAuthトークン
- channel(必須):チャネルIDまたは名前(例:
#alerts)
Microsoft Teams
Section titled “Microsoft Teams”{ "type": "MeddleNotification", "config": { "channel": "teams", "template": "Machine {{ .machine_id }} stopped. Status: {{ .status }}", "teamsConfig": { "webhookUrl": "https://outlook.office.com/webhook/..." } }}teamsConfigフィールド:
- webhookUrl(必須):Teamsで設定されたインカミングWebhook URL
メール(SMTP)
Section titled “メール(SMTP)”{ "type": "MeddleNotification", "config": { "channel": "email", "template": "Alert from sensor {{ .sensor_id }}: {{ .message }}", "emailConfig": { "smtpHost": "smtp.example.com", "smtpPort": 587, "from": "alerts@example.com", "to": ["ops@example.com", "manager@example.com"], "username": "alerts@example.com", "password": "app-specific-password" } }}emailConfigフィールド:
- smtpHost(必須)、smtpPort(必須)
- from(必須、有効なメールアドレスである必要があります)
- to(必須、最小1受信者)
- username、password: オプションのSMTP認証
Microsoft 365(Graph API)
Section titled “Microsoft 365(Graph API)”OAuth2クライアント資格情報を使用してMicrosoft Graph経由でメールを送信します。Mail.Sendアプリケーション権限(管理者同意済み)を持つAzure ADアプリ登録が必要です。
{ "type": "MeddleNotification", "config": { "channel": "microsoft365", "template": "Production halted on line {{ .line_id }}", "microsoft365Config": { "tenantId": "00000000-0000-0000-0000-000000000000", "clientId": "11111111-1111-1111-1111-111111111111", "authMethod": "secret", "clientSecret": "your-client-secret", "fromAddress": "alerts@yourtenant.onmicrosoft.com", "to": ["ops@yourtenant.onmicrosoft.com"], "subject": "Production Alert", "saveToSentItems": true } }}microsoft365Configフィールド:
- tenantId(必須)、clientId(必須)
- authMethod:
secret(デフォルト)またはcertificate - clientSecret:
authMethodがsecretの場合に必須 - certificate:
authMethodがcertificateの場合に必須。certificateFile+privateKeyFile(PEM)またはpfxFile(+ オプションのpfxPassword)のいずれかを提供。 - fromAddress(必須、ライセンス付きメールボックスと一致する有効なメールアドレスである必要があります)
- to(必須、最小1受信者)
- subject: メール件名(デフォルト
Meddle Notification) - saveToSentItems:
trueの場合、メッセージはメールボックスの送信済みアイテムに保存されます
Webhook
Section titled “Webhook”{ "type": "MeddleNotification", "config": { "channel": "webhook", "webhookUrl": "https://hooks.example.com/incoming", "template": "{{ .machine_id }}: {{ .status }}" }}webhookUrlにJSON本文{ "message": "...", "data": { ...payload... } }をPOSTします。
テンプレート
Section titled “テンプレート”テンプレートはGoのtext/template構文を使用します。一般的なパターン:
Temperature: {{ .temperature }}°C{{ if gt .pressure 100.0 }}Pressure HIGH{{ end }}Sensor {{ .sensor_id }} reported {{ .status }} at {{ .timestamp }}テンプレートが設定されていない場合、完全なペイロードがJSONエンコードされてメッセージとなります。
ユースケース
Section titled “ユースケース”- しきい値違反に対するオペレータ通知
- SlackまたはTeams経由でのオンコールチャネルへのインシデントルーティング
- SIEMまたはHTTPエンドポイントへのWebhook経由での監査ログ
- Microsoft 365 OAuth(SMTPパスワード不要)による企業メールアラート
ベストプラクティス
Section titled “ベストプラクティス”- テンプレートを使用してメッセージを短く、人間が読みやすく、アクション可能に保つ
- チャネルのフラッディングを避けるために、上流にTriggerまたはRate Limiterを配置
- Microsoft 365の場合、本番環境では証明書認証を優先し、シークレットを定期的にローテーション
- 特定のプロバイダ統合を必要としない内部システムに送信する場合は、Webhookチャネルを使用
関連コネクタ
Section titled “関連コネクタ”- Alert - 期間とクールダウン付きのステートフルアラート
- Trigger - 条件で通知をゲート
- Rate Limiter - 通知頻度を制限