@@ -22,6 +22,7 @@ Below is a list of available events with a brief description for each one. You c
2222| RcbChangePathEvent | Emitted when the chatbot changes its conversation path. |
2323| RcbChunkStreamMessageEvent | Emitted when a chunk of a streamed message is received. |
2424| RcbDismissToastEvent | Emitted when a toast message is dismissed. |
25+ | RcbSaveChatHistoryEvent | Emitted when chat messages are saved to history. |
2526| RcbLoadChatHistoryEvent | Emitted when the chat history is loaded. |
2627| RcbPostInjectMessageEvent | Emitted after a message is injected into the chat. |
2728| RcbPreInjectMessageEvent | Emitted before a message is injected into the chat. |
@@ -175,6 +176,43 @@ const MyComponent = () => {
175176};
176177```
177178
179+ ### RcbSaveChatHistoryEvent
180+
181+ #### Description
182+ Emitted when chat messages are saved to history.
183+
184+ #### Note
185+ - Requires ` settings.event.rcbSaveChatHistory ` to be set to true.
186+ - Event is ** preventable** with ` event.preventDefault() ` .
187+
188+ #### Data
189+ | Name | Type | Description |
190+ | -----------| --------------| -----------------------------------------------------------------|
191+ | messages | ` Message[] ` | The chat messages being saved to history. |
192+
193+ #### Code Example
194+ ``` jsx
195+ import { useEffect } from " react" ;
196+ import { RcbSaveChatHistoryEvent } from " react-chatbotify" ;
197+
198+ const MyComponent = () => {
199+ useEffect (() => {
200+ const handleSaveChatHistory = (event : RcbSaveChatHistoryEvent ) => {
201+ // handle the save chat history event
202+ };
203+
204+ window .addEventListener (" rcb-save-chat-history" , handleSaveChatHistory);
205+ return () => {
206+ window .removeEventListener (" rcb-save-chat-history" , handleSaveChatHistory);
207+ };
208+ }, []);
209+
210+ return (
211+ < ExampleComponent/ >
212+ );
213+ };
214+ ```
215+
178216### RcbLoadChatHistoryEvent
179217
180218#### Description
0 commit comments