docs/agents/custom-code-agent/setup-your-agent/connect-components.mdx
Novu provides pre-built UI components for chat platforms like Slack, Microsoft Teams, Telegram and other communication platforms. Add these components so users can install the communication platform app in their workspace and connect it to your agent.
SlackConnectButton is a pre-built UI component in the @novu/react SDK that connects an agent to a Slack workspace. Check out the example below.
import { SlackConnectButton } from '@novu/react';
const SlackConnectButtonComponent = () => {
const subscriberId = 'subscriber-id';
const integrationIdentifier = 'integration-identifier';
const agent = {
identifier: 'agent-identifier',
name: 'agent-name',
};
const handleSlackOAuthSuccess = () => {
// Handle success
};
return (
<SlackConnectButton
integrationIdentifier={integrationIdentifier}
connectionIdentifier={`${subscriberId}:${integrationIdentifier}:${agent.identifier}`}
connectionMode="subscriber"
connectLabel={`Install ${agent.name} ↗`}
connectedLabel="Connected to Slack"
onConnectSuccess={handleSlackOAuthSuccess}
onConnectError={(error: unknown) => {
console.error(error);
}}
/>
);
};
export default SlackConnectButtonComponent;
<Prompt description="Add SlackConnectButton to my app" icon="plug" actions={["copy", "cursor"]}> Add the Novu SlackConnectButton from @novu/react to my app so each of my end users can connect "YOUR_AGENT_NAME" to their own Slack workspace.
Context: The Slack integration already exists in Novu. This is purely a frontend code integration — do NOT run the Novu CLI or the agent-onboarding flow.
Requirements:
<SlackConnectButton /> inside a <NovuProvider> configured for the currently signed-in end user.Optional reference: https://docs.novu.co/agents/custom-code-agent/setup-your-agent/connect-components </Prompt>
SlackConnectButton accepts the following props to customize the UI and behavior:
TelegramConnectButton is a pre-built UI component in the @novu/react SDK that links a subscriber's Telegram chat to your agent. It authenticates with the subscriber JWT from NovuProvider, so no secret key is exposed in the browser.
When clicked, the button issues a t.me/<bot>?start=<code> deep link, opens it in a new tab, and polls until the subscriber presses Start in Telegram. Clicking again while connected disconnects the chat.
import { NovuProvider, TelegramConnectButton } from '@novu/react';
const TelegramConnectButtonComponent = () => {
const subscriberId = 'subscriber-id';
const integrationIdentifier = 'telegram-integration-identifier';
return (
<NovuProvider subscriberId={subscriberId} applicationIdentifier="application-identifier">
<TelegramConnectButton
integrationIdentifier={integrationIdentifier}
connectLabel="Connect Telegram"
connectedLabel="Connected to Telegram"
onConnectSuccess={(endpointIdentifier) => {
console.log('Connected', endpointIdentifier);
}}
onConnectError={(error: unknown) => {
console.error(error);
}}
onDisconnectSuccess={() => {
// Handle disconnect
}}
/>
</NovuProvider>
);
};
export default TelegramConnectButtonComponent;
<Prompt description="Add TelegramConnectButton to my app" icon="plug" actions={["copy", "cursor"]}> Add the Novu TelegramConnectButton from @novu/react to my app so each of my end users can connect "YOUR_AGENT_NAME" to their own Telegram chat.
Context: The Telegram integration already exists in Novu. This is purely a frontend code integration — do NOT run the Novu CLI or the agent-onboarding flow.
Requirements:
<TelegramConnectButton /> inside a <NovuProvider> configured for the currently signed-in end user.Optional reference: https://docs.novu.co/agents/custom-code-agent/setup-your-agent/connect-components </Prompt>
TelegramConnectButton accepts the following props to customize the UI and behavior:
| Property | Type | Description |
|---|---|---|
integrationIdentifier | string | Required. Identifier of the Telegram integration to link against. |
subscriberId | string | Optional. Subscriber to link. Defaults to the NovuProvider subscriber. |
onConnectSuccess | (endpointIdentifier: string) => void | Called once the Telegram chat endpoint is detected. |
onConnectError | (error: unknown) => void | Called when issuing the link fails or polling times out. |
onDisconnectSuccess | () => void | Called after the chat endpoint is removed. |
onDisconnectError | (error: unknown) => void | Called when disconnecting fails. |
connectLabel | string | Label shown when disconnected. Defaults to Connect Telegram. |
connectedLabel | string | Label shown when connected. Defaults to Connected to Telegram. |
appearance | Appearance | Style overrides reusing the shared channelConnectButton* keys. |
container | HTMLElement | Optional element to render the component into. |