Back to Copilotkit

Message

showcase/shell-docs/src/content/reference/channels/components/Message.mdx

1.64.21.6 KB
Original Source

Message groups one portable message tree.

tsx
import { Message, Section } from "@copilotkit/channels/ui";

<Message>
  <Section>Checkout latency is above the SLO.</Section>
</Message>;

Props

PropTypeDescription
accentstringOptional renderer hint. Direct adapters may map it natively; the current managed Slack and Teams connectors ignore it.
onReactionMessageReactionHandlerHandles an added or removed reaction on this posted message.
childrenBotChildrenPortable Channels content.

onReaction receives the normalized emoji first and a reaction context second. The context contains added, rawEmoji, user, thread, messageId, and messageRef.

tsx
<Message
  onReaction={async (emoji, reaction) => {
    const marked = reaction.added && emoji === "eyes";
    await reaction.thread.post(
      marked ? "Marked for follow-up." : "Reaction update received.",
    );
  }}
>
  <Section>React with 👀 to request follow-up.</Section>
</Message>

Managed Slack routes reactions on bot-authored messages. Managed Teams routes delivered messageReaction activities. The managed adapter cannot add or remove the bot's own reactions.

An output-free managed reaction callback is finalized and acknowledged. Silent audit-only work is supported, but make the side effect idempotent because managed delivery is at-least-once.

Register named components containing onReaction in createChannel({ components }); a durable StateStore is also required for a reaction to an older message to survive a process restart.