Skip to content

Commit f16c7bd

Browse files
committed
Add theme instructions to README
1 parent 8de8d4d commit f16c7bd

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

chatbot-integration/openai-chatgpt/README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ This is an example project for TalkJS's tutorial on [How to integrate a chatbot
44

55
The project uses TalkJS webhooks to listen for new message events from the TalkJS server, calls the OpenAI API to generate a message reply, and then adds the reply to the conversation with the TalkJS API.
66

7-
> [!TIP]
8-
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/chatbot-integration.openai-chatgpt.zip)
7+
> [!TIP] > [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/chatbot-integration.openai-chatgpt.zip)
98
109
## Prerequisites
1110

@@ -23,7 +22,25 @@ To run this tutorial, you will need:
2322
2. Replace `<APP_ID>` and `<TALKJS_SECRET_KEY>` in `index.html` and `server.js` with the values found in your [TalkJS dashboard](https://talkjs.com/dashboard/login).
2423
3. Replace `<OPENAI_SECRET_KEY>` with your OpenAI API key
2524
4. Enable the `message.sent` option in the **Webhooks** section of the TalkJS dashboard.
26-
5. Start ngrok with `ngrok http 3000`.
27-
6. Add the ngrok URL to **Webhook URLs** in the TalkJS dashboard, along with the `/onMessageSent` path: `https://<YOUR_SITE>.ngrok-free.app/onMessageSent`.
28-
7. Run `npm install` to install dependencies.
29-
8. Run `npm start` to start the webhooks server.
25+
5. Update the theme to show a typing indicator when the bot is generating a response. In the **Themes** tab, select to **Edit** the the `default` theme. Select the `UserMessage` component from the list of **Built-in components** and replace the existing `MessageBody` component with the following:
26+
27+
```jsx
28+
<div t:if="{{ custom.isTyping == 'true' }}" class="typing-indicator">
29+
<TypingIndicator />
30+
</div>
31+
32+
<MessageBody t:else
33+
body="{{ body }}"
34+
timestamp="{{ timestamp }}"
35+
floatTimestamp="auto"
36+
showStatus="{{ sender.isMe }}"
37+
isLongEmailMessage="{{isLongEmailMessage}}"
38+
darkenMenuArea="{{ darkenMenuArea }}"
39+
hasReferencedMessage="{{ hasReferencedMessage }}"
40+
/>
41+
```
42+
43+
6. Start ngrok with `ngrok http 3000`.
44+
7. Add the ngrok URL to **Webhook URLs** in the TalkJS dashboard, along with the `/onMessageSent` path: `https://<YOUR_SITE>.ngrok-free.app/onMessageSent`.
45+
8. Run `npm install` to install dependencies.
46+
9. Run `npm start` to start the webhooks server.

0 commit comments

Comments
 (0)