Skip to content

Commit 8ebc31e

Browse files
authored
Merge pull request #548 from talkjs/feat/add-team-chat-with-threads
Add example code for team chat with threads
2 parents 2201173 + 299cf55 commit 8ebc31e

20 files changed

+29795
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Intro
2+
3+
This example shows you how to use React and TalkJS to create a team chat with channels and reply threads (like Slack or Teams). It's similar to our [remote work demo](https://talkjs.com/demo/team-chat/) that you can try on our website.
4+
5+
<!-- See our [How to add reply threads to your TalkJS team chat]() tutorial for more details. -->
6+
7+
## Prerequisites
8+
9+
To run this tutorial, you will need:
10+
11+
- A [TalkJS account](https://talkjs.com/dashboard/login)
12+
- [Node.js](https://nodejs.org/en)
13+
- [npm](https://www.npmjs.com/)
14+
- [ngrok](https://ngrok.com/)
15+
16+
## Instructions
17+
18+
1. Clone or download the project
19+
1. Start ngrok with `ngrok http 3001`. You should see a forwarding URL which is something like `https://<YOUR_URL>.ngrok-free.app`
20+
1. In the TalkJS dashboard:
21+
1. In the **Themes** tab, select to **Edit** the `team_chat` theme and replace the `UserMessage` template with the version in `theme/UserMessage.txt`.
22+
1. In the **Chat UI** tab:
23+
1. Select the `default` role and select to use the `team_chat` theme
24+
1. Under **Built-in message actions**, select "None" for the **Reply** action
25+
1. Under **Custom message actions**, create a new action with a name of "replyInThread" and a label of "Reply in thread", available to all messages for users with write permission
26+
1. In the **Settings** tab under **Webhooks**:
27+
1. enable the "message.sent" option.
28+
1. Add the ngrok URL to **Webhook URLs** in the TalkJS dashboard, adding `/update-reply-count`: `https://<YOUR_URL>.ngrok-free.app/update-reply-count`
29+
1. Inside the `/backend` directory:
30+
1. Replace `<APP_ID>` and `<SECRET_KEY>` in `server.js` with the values found in the **Settings** tab of your [TalkJS dashboard](https://talkjs.com/dashboard/login).
31+
1. Install dependencies by running `npm install`
32+
1. Start the server with `npm start`
33+
1. Inside the `/src` directory:
34+
1. Replace `<APP_ID>` in `talkjsConfig.js` with the value found in the **Settings** tab of your [TalkJS dashboard](https://talkjs.com/dashboard/login)
35+
1. Install dependencies by either running `npm install`
36+
1. Start the app with `npm start`
37+
38+
You can now view your app at localhost:3000.
39+
40+
The app is prepopulated with a default user and a couple of hardcoded conversations, which easily can be replaced with your own users and conversations. You can find these conversations and the default `userId` in `src/talkJsConfig.js` as well.

0 commit comments

Comments
 (0)