Back to Novu

Telegram

docs/agents/channels/telegram.mdx

3.19.03.5 KB
Original Source

Use Telegram as a messaging channel for your agent. Novu keeps conversation context, shows typing during the turn, can update a plan card in place, and uses inline keyboard buttons for choices and tool approval.

Capabilities

CapabilitySupport
Full context historyYes
Threaded repliesYes
Live typing indicator (custom status text)Yes
React with eyes on inbound messagesYes
Plan card (markdown edit-in-place)Yes
Rich text / markdownYes
Tap-to-respond buttons (inline keyboard)Yes
Emoji reactionsYes
Message edits in placeYes
Action / MCP tool approvalYes
MCP connect cardYes
Resolve conversationYes
File sharingNot yet
Streaming word-by-wordNot yet

Full matrix: Channels overview.

Examples

Inbound message

A user messages the bot. Novu adds an eyes reaction, shows typing with optional custom status text, updates a plan card while tools run, then replies with inline keyboard buttons.

Tool approval

Gated tools post Approve once / Deny / Always allow. The handler resumes after the user selects an option.

Setup

Framework / PlatformGuide
Custom code agentFollow a connect guide, then add Telegram as another provider
Managed agentClaude or AWS Claude, then link Telegram in the dashboard

Connect component

Use TelegramConnectButton from @novu/react so end users can link their Telegram chat to your agent. The button issues a t.me/<bot>?start=<code> deep link, opens it, and polls until the user presses Start in Telegram.

tsx
import { NovuProvider, TelegramConnectButton } from '@novu/react';

export function TelegramConnect() {
  const subscriberId = 'subscriber-id';
  const integrationIdentifier = 'telegram-integration-identifier';

  return (
    <NovuProvider
      applicationIdentifier={process.env.NEXT_PUBLIC_NOVU_APPLICATION_IDENTIFIER!}
      subscriberId={subscriberId}
    >
      <TelegramConnectButton
        integrationIdentifier={integrationIdentifier}
        connectLabel="Connect Telegram"
        connectedLabel="Connected to Telegram"
        onConnectSuccess={(endpointIdentifier) => {
          console.log('Connected', endpointIdentifier);
        }}
        onConnectError={(error: unknown) => {
          console.error(error);
        }}
        onDisconnectSuccess={() => {
          // Chat unlinked
        }}
      />
    </NovuProvider>
  );
}

Props and appearance options: Connect components.

<Columns cols={2}> <Card href="/agents/custom-code-agent/building-blocks/reply" title="Reply" icon="message-square"> Plain text, markdown, and interactive cards. </Card> <Card href="/agents/custom-code-agent/building-blocks/typing-indicator" title="Typing indicator" icon="ellipsis"> Custom status text while the handler runs. </Card> <Card href="/agents/custom-code-agent/building-blocks/tool-approval" title="Tool approval" icon="shield-check"> Approve / Deny before tools execute. </Card> <Card href="/agents/custom-code-agent/building-blocks/edit-sent-messages" title="Edit sent messages" icon="pencil"> Update a sent message in place. </Card> <Card href="/agents/custom-code-agent/connect-components" title="Connect components" icon="plug"> TelegramConnectButton props and appearance. </Card> </Columns>