コンテンツにスキップ

Messaging Providers 概要

Greentic は Messaging Providers を通じて複数の messaging platform をサポートします。各 provider は次を処理する WASM component pack です:

  • Ingress - platform からメッセージを受信する
  • Egress - platform へメッセージを送信する
  • Operations - platform 固有の機能(button、card、thread)
External Platform (Slack/Teams/Telegram)
▼ Webhook
┌─────────────────────────────────────────┐
│ Ingress Component │
│ (Parse platform-specific format) │
└─────────────────────────────────────────┘
▼ Normalized Message
┌─────────────────────────────────────────┐
│ NATS Bus │
│ greentic.messaging.ingress.{tenant}... │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ Flow Executor │
│ (Process with your flows) │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ NATS Bus │
│ greentic.messaging.egress.{tenant}... │
└─────────────────────────────────────────┘
▼ Platform-specific format
┌─────────────────────────────────────────┐
│ Egress Component │
│ (Format for platform API) │
└─────────────────────────────────────────┘
▼ API Call
External Platform

すべての provider はメッセージを共通フォーマットに正規化します:

pub struct NormalizedMessage {
pub id: String,
pub channel_id: String,
pub sender_id: String,
pub sender_name: Option<String>,
pub content: String,
pub timestamp: u64,
pub reply_to: Option<String>,
pub attachments: Vec<Attachment>,
pub metadata: Option<Value>,
}

これにより、flow は修正なしでどの messaging platform 上でも動作できます。

greentic.demo.yaml
providers:
messaging-telegram:
pack: "providers/messaging/messaging-telegram.gtpack"
setup_flow: "setup_default"
verify_flow: "verify_webhooks"
messaging-slack:
pack: "providers/messaging/messaging-slack.gtpack"
setup_flow: "setup_default"
answers.json
{
"messaging-telegram": {
"enabled": true,
"public_base_url": "https://example.ngrok-free.app",
"bot_token": "123456789:ABCdefGHI..."
},
"messaging-slack": {
"enabled": true,
"public_base_url": "https://example.ngrok-free.app",
"bot_token": "xoxb-xxx-xxx",
"slack_app_id": "A07XXX"
}
}

メッセージは tenant 単位の subject で NATS を流れます:

SubjectDirection
greentic.messaging.ingress.{env}.{tenant}.{team}.{channel}受信
greentic.messaging.egress.{env}.{tenant}.{team}.{channel}送信

すべての provider は基本的な text message をサポートします:

- id: reply
type: reply
config:
message: "Hello! How can I help?"

ほとんどの provider は rich content をサポートします:

- id: send_card
type: adaptive-card
config:
card: "cards/welcome.json"

interactive 要素(provider 依存):

- id: ask_choice
type: reply
config:
message: "What would you like to do?"
buttons:
- label: "Get Help"
action: "help"
- label: "Contact Support"
action: "support"

ファイルと media をサポートします:

- id: send_file
type: reply
config:
message: "Here's your report"
attachments:
- type: file
url: "https://example.com/report.pdf"
name: "report.pdf"

複数チャネルで動く flow を書けます:

flows/on_message.ygtc
name: universal_handler
version: "1.0"
nodes:
- id: greet
type: reply
config:
# Works on any platform
message: "Hello! I'm your assistant."
next: ask_intent
- id: ask_intent
type: reply
config:
message: "How can I help you today?"
# Buttons render differently per platform
buttons:
- label: "Get Started"
action: "start"
- label: "Help"
action: "help"
triggers:
- type: message
pattern: "hello|hi"
target: greet
FeatureSlackTeamsTelegramWhatsAppWebChatWebexEmail
TextYesYesYesYesYesYesYes
Rich CardsYesYesPartialYesYesYesNo
ButtonsYesYesYesYesYesYesNo
FilesYesYesYesYesYesYesYes
ThreadsYesYesYesNoNoYesYes
ReactionsYesYesNoYesNoNoNo

使い始める provider を選んでください:

  • Telegram - セットアップが最も簡単で、テストにも向いている
  • Slack - フル機能の workspace integration
  • WebChat - website に埋め込む