---
name: kg-message-sync
description: "Sync knowledge graph node summary updates to channel messages — edits messages on Telegram/Discord/Slack when a node's summary field changes, updates status reaction emojis."
homepage: https://docs.minion.ai/automation/hooks#kg-message-sync
metadata:
  {
    "minion":
      {
        "emoji": "🔗",
        "events": ["memory:node_updated"],
        "install": [{ "id": "bundled", "kind": "bundled", "label": "Bundled with Minion" }],
      },
  }
---

# KG Message Sync Hook

Reactively syncs knowledge graph node changes to channel messages. When an agent updates a node's `summary` field via `update_entity`, this hook automatically edits the corresponding channel message with the new content and updates the status reaction emoji.

## What It Does

When a `memory:node_updated` event fires:

1. **Checks eligibility** — node must have `message_id`, `chat_id`, and `channel` in its `data` field
2. **Detects summary change** — compares `data.summary` with `previousData.summary`
3. **Edits the message** — calls the channel's edit API (Telegram `editMessage`, Discord `editMessage`, Slack `update`)
4. **Updates status emoji** — reacts with the emoji matching `data.status`

## Channel Support

| Channel  | Message Edit | Status Reaction      |
| -------- | ------------ | -------------------- |
| Telegram | Yes          | Yes                  |
| Discord  | Yes          | Yes                  |
| Slack    | Yes          | Yes                  |
| WhatsApp | No (skipped) | Yes (reactions only) |

## Node Data Requirements

The hook only activates when the node's `data` object contains:

- `message_id` — channel message ID to edit
- `chat_id` — channel chat/conversation ID
- `channel` — channel identifier (`telegram`, `discord`, `slack`, `whatsapp`)

## Status Emoji Mapping

| Status    | Emoji |
| --------- | ----- |
| `pending` | ⏳    |
| `running` | 🔄    |
| `passed`  | ✅    |
| `failed`  | ❌    |
| `partial` | ⚠️    |
| `blocked` | 🚫    |

## Configuration

```json
{
  "hooks": {
    "internal": {
      "entries": {
        "kg-message-sync": {
          "enabled": true
        }
      }
    }
  }
}
```

## Disabling

```bash
minion hooks disable kg-message-sync
```
