⚠️ Experimental — Manages a Guild chat subscription that routes inbound Slack/Teams events to an agent or installed app.
# When to use: Route inbound Slack/Teams events (mention, message, alert_bot)
# to an agent or installed app. Select channels by operator tag and/or explicit
# Guild chat channel UUIDs from sg_chat_channel.
#
# Prerequisites: target agent/app exists; channels registered (sg_chat_channel
# or auto-enrolled via sg_chat_channel_rule) and tagged appropriately.
#
# Related: sg_chat_channel, sg_chat_channel_rule, sg_agent, sg_app.
resource "sg_chat_subscription" "sre_mentions" {
name = "sre-mention-router"
target_type = "agent"
target_name = "sre-investigator" # replace with sg_agent.*.name or app-managed agent
trigger_types = ["mention", "message"]
enabled = true
precedence = 100
channel_selector = {
tag = "incidents"
# channel_ids = [sg_chat_channel.incidents.id]
}
# Optional CEL gate — only fire when the message looks like an alert.
# filter_cel = "event.text.contains(\"ALERT\")"
}
Import an existing sg_chat_subscription using its subscription UUID:
terraform import sg_chat_subscription.example '123e4567-e89b-12d3-a456-426614174000'
channel_selector (Attributes) Selects which registered chat channels this subscription applies to (by tag and/or channel IDs). (see below for nested schema)name (String) Human-readable subscription name. Changing forces replacement.target_name (String) Name of the agent or installed app to invoke.target_type (String) Invocation target type. Must be agent or app.trigger_types (List of String) Inbound event types that fire this subscription. Values: alert_bot, mention, message.alert_bot_app_ids (List of String) Provider app IDs treated as alert bots when trigger_types includes alert_bot.app_name (String) Optional installed app catalog name that owns this subscription. Changing forces replacement (create-only on the API).domain_config (Map of String) Opaque domain-specific configuration map.enabled (Boolean) Whether the subscription is active. Defaults to true when omitted.endpoint_path (String) Relative POST path for app targets.filter_cel (String) Optional CEL expression that must evaluate true for the event to fire.precedence (Number) Lower values win when multiple subscriptions match. Guild default is 100.responder_allowlist_ref (String) Optional allowlist reference restricting who may trigger the subscription.created_at (String) Creation timestamp (RFC 3339).id (String) Server-assigned chat subscription UUID. Import with: terraform import sg_chat_subscription.example ‘updated_at (String) Last modification timestamp (RFC 3339).channel_selectorOptional:
channel_ids (List of String) Explicit Guild chat channel UUIDs to match.tag (String) Match channels that carry this operator tag.