Live Chat

In addition to providing a way to chat with AI agents, the ChatProvider component (and corresponding useChatStore hook) supports live chat, so that you can chat directly with your customers through the Markprompt dashboard. One common scenario is to have your customers chat with an AI agent, and when the agent is unable to resolve the customer’s issue, you can switch the ChatProvider to use live chat. To do this, you can use the liveChatOptions property of the chatOptions prop on the ChatProvider component. You can also specify the user’s information through the user property of the chatOptions prop. This will ensure that the support agent that is chatting with the customer knows who they are speaking with.

1<ChatProvider
2  chatOptions={{
3    liveChatOptions: { enabled: true },
4    user: {
5      name: 'John Doe',
6      email: 'john.doe@example.com',
7    },
8  }}
9/>

As with the other chat options, you can also use the useChatStore hook to change the options in any component under the ChatProvider.

1const { setChatOptions } = useChatStore((state) => state.setChatOptions);
2
3setChatOptions({
4  liveChatOptions: { enabled: true },
5  user: { name: 'John Doe', email: 'john.doe@example.com' },
6});