Agent Chat is in closed beta. Contact us at [email protected] to get access.
Prerequisites
Complete channel setup first. Then you need:- Your application identifier from API Keys
- A subscriber id for the signed-in person
- The public agent identifier from the agent page in the dashboard
Install and wrap NovuProvider
@novu/react requires React 18 or later (^18.0.0 or ^19.0.0).useAgentChat reads the Novu client from context. Place NovuProvider above the chat.
- US
- EU
NovuProvider authenticates the subscriber. useAgentChat selects which agent to talk to.
Add Novu Agent Chat to my React app
Send a message
OmitconversationId to start a new chat. The first successful send creates the conversation.
isRunning or isLoading is true, disable the composer. The agent is still working on the turn.
Receive and render parts
messages is the ordered timeline. Each message has role (user or assistant) and parts.
Start with type === 'text'. Then handle the other part types as you need them.
useAgentChat.
Thinking and running
While the agent turn is in progress,isRunning is true. typing is present when the agent is typing. Assistant messages can include thinking parts before text arrives.
Tool approval and MCP connect
pendingActions lists waits that block the turn. Do not mix the two action types.
action.id from pendingActions. Do not invent approve or deny ids.
Resume or start another chat
PassconversationId so the hook loads history on mount.
conversationId that sendMessage returns, or the conversationId field on the hook result. On the next visit, pass that id back in.
The hook has no list-conversations API. You store the ids that you want to reopen.
To start another chat, remount the component without conversationId, or clear the prop.
Switch agent
agentId selects the agent. If the identifier changes, remount with the new agentId.
Omit conversationId unless that conversation belongs to the new agent. A conversation id from a different agent does not resume.
Going to production
HMAC is off by default. Turn it on before you ship. Agent Chat can require two hashes. Each hash has its own dashboard toggle.
Both hashes use the same secret: the environment API secret from API Keys. Compute them on your server. Do not compute them in the browser.
subscriberHash
subscriberHash authenticates the signed-in subscriber. Without it, another person can guess a subscriberId and open that subscriber’s session, including Agent Chat.
If Security HMAC encryption is on for Novu In-App, pass subscriberHash to NovuProvider. The hash is HMAC-SHA256(secretKey, subscriberId) as a lowercase hex string.
Generation recipes (Node.js, Python, and more): Secure your Inbox with HMAC.
agentHash
agentHash authenticates which agent the subscriber can talk to. Without it, a client can send any public agent identifier that is linked to Agent Chat.
If Security HMAC encryption is on for Agent Chat:
- Open Integrations.
- Select the Agent Chat integration.
- Enable Security HMAC encryption.
- On your server, compute
HMAC-SHA256(secretKey, agentIdentifier)as a lowercase hex string. - Pass that value as
agentHashtouseAgentChat.
Next steps
useAgentChat reference
Props, return value, callbacks, and message parts.
Channel setup
Link Agent Chat on the agent.