Skip to content

Commit bd47a88

Browse files
committed
docs: Add documentation for bot id hook
1 parent c05ec91 commit bd47a88

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

docs/api/hooks.md

+29-5
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,18 @@ Below is a list of available hooks along with a brief description for each of th
8383
| Name | Description |
8484
| ------------------- | --------------------------------------------------------------------------------------- |
8585
| useAudio | Manages audio functionalities, such as toggling audio on or off. |
86+
| useBotId | Allows retrieving of bot id (mainly for plugin developers). |
8687
| useChatHistory | Handles loading, retrieving and setting of chat history messages. |
8788
| useChatWindow | Manages the state of the chatbot window (open/close). |
8889
| useFirstInteraction | Detects and tracks the user's first interaction with the chatbot. |
89-
| useFlow | Allows getting and restarting chatbot flow and tracks if flow has started. |
90+
| useFlow | Allows retrieving and restarting chatbot flow and tracks if flow has started. |
9091
| useMessages | Handles sending, clearing, and retrieving messages in the chatbot. |
9192
| useNotifications | Manages chatbot notifications, such as toggling notifications on or off. |
9293
| usePaths | Manages chatbot conversation paths, such as navigation |
9394
| useSettings | Accesses and modifies chatbot settings. |
9495
| useStyles | Accesses and modifies chatbot styles. |
9596
| useTextArea | Manages the text input area of the chatbot, including setting and clearing values. |
96-
| useToasts | Manages toasts shown within the chatbot, such as showing or missing them. |
97+
| useToasts | Manages toasts shown within the chatbot, such as showing or missing them. |
9798
| useVoice | Manages voice functionality, such as toggling voice on or off |
9899

99100
## Hook Details
@@ -126,6 +127,29 @@ const MyNestedComponent = () => {
126127
};
127128
```
128129

130+
### useBotId
131+
132+
#### Description
133+
The `useBotId` hook allows you to retrieve the bot id (mainly for plugin developers).
134+
135+
#### Return Values
136+
| Name | Type | Description |
137+
| -------------- | ----------- | ------------------------------------------------------ |
138+
| getBotId | `function ` | Retrieves the bot id. |
139+
140+
#### Code Example
141+
```jsx
142+
import { useBotId } from "react-chatbotify";
143+
144+
const MyNestedComponent = () => {
145+
const { getBotId } = useBotId();
146+
147+
return (
148+
<button onClick={getBotId}></button>
149+
)
150+
};
151+
```
152+
129153
### useChatHistory
130154

131155
#### Description
@@ -191,11 +215,11 @@ import { useEffect } from "react";
191215
import { useFirstInteraction } from "react-chatbotify";
192216

193217
const MyNestedComponent = () => {
194-
const { hasFlowStarted } = useFirstInteraction();
218+
const { hasInteractedPage } = useFirstInteraction();
195219

196220
useEffect(() => {
197-
// do something if flow has started
198-
}, [hasFlowStarted])
221+
// do something if has interacted
222+
}, [hasInteractedPage])
199223

200224
return (
201225
<ExampleComponent/>

0 commit comments

Comments
 (0)