You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code shows how you can embed TalkJS into a WebView using Android.
5
-
The app itself is a minimal WhatsApp clone with a hardcoded contact list.
3
+
This code shows how you can embed TalkJS into a WebView using Android. The app itself is a minimal WhatsApp clone with a hardcoded contact list.
6
4
7
5
It shows off three use cases:
8
6
- Show a conversation list (the "inbox")
@@ -13,3 +11,6 @@ How it works, in brief:
13
11
1. When the Inbox (`InboxTab`) is opened, a webview is created which runs the JS code in `asserts/chat.js`, which is generic for all three use cases
14
12
2. The JS code calls back into the app via `JavascriptCallbacks.getOptions` to determine what to do (open an inbox, start a chat with somebody, etc). Then, it calls TalkJS SDK methods as described in the [TalkJS docs](https://talkjs.com/docs).
15
13
3. When a user clicks on a conversation in the inbox, an intent is generated to navigate to the `ChatboxActivity`, which reuses the code above to display a chatbox of a single conversation, instead of a conversation list.
14
+
15
+
> [!TIP]
16
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/android.basic-example.zip)
Copy file name to clipboardexpand all lines: android/file-upload-example/README.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,20 @@
1
-
# TalkJS Android File Upload Example
1
+
# Android file upload example
2
2
3
3
This code shows how to implement file upload support in Android's WebView.
4
4
Despite TalkJS already supporting uploading of files, the default Android WebView implementation
5
5
does not implement file uploads. The code also shows how to upload rich content
6
6
to TalkJS via the [unified API](https://developer.android.com/develop/ui/views/receive-rich-content)
7
7
This enables users to upload images and videos from the clipboard, keyboard or through drag and drop.
8
8
9
+
> [!TIP]
10
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/android.file-upload-example.zip)
11
+
9
12
## Getting Started
10
13
11
14
It is recommended to open this project in Android Studio so that Gradle sync is handled
12
15
automatically for you.
13
16
14
-
Before running the app, don’t forget to replace the string, YOUR_APP_ID, with your TalkJS app ID from the dashboard.
17
+
Before running the app, don’t forget to replace the string, `YOUR_APP_ID`, with your app ID from the [TalkJS dashboard](https://talkjs.com/dashboard/).
15
18
16
19
This code sample was used as part of two tutorials:
Copy file name to clipboardexpand all lines: angular/angular-chat-app/README.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,9 @@
2
2
3
3
This is an example project for TalkJS's tutorial on [how to build a chat into an Angular app with TalkJS](https://talkjs.com/resources/angular-chat-app/).
4
4
5
+
> [!TIP]
6
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/angular.angular-chat-app.zip)
7
+
5
8
## Prerequisites
6
9
7
10
To run this tutorial, you will need:
@@ -13,7 +16,7 @@ To run this tutorial, you will need:
13
16
14
17
## How to run the tutorial
15
18
16
-
1. Clone or download the project.
19
+
1. Clone or [download this project](https://github.com/talkjs/talkjs-examples/releases/latest/download/angular.angular-chat-app.zip).
17
20
2. Replace `YOUR_APP_ID_HERE` in `src/app/talk.service.ts` with your own app ID. You can find your app ID on the **Settings** page of your [TalkJS dashboard](https://talkjs.com/dashboard/).
Copy file name to clipboardexpand all lines: angular/angular-getting-started/README.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,9 @@
2
2
3
3
This is the example code for the [Angular getting started guide](https://talkjs.com/docs/Getting_Started/Frameworks/Angular/).
4
4
5
+
> [!TIP]
6
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/angular.angular-getting-started.zip)
7
+
5
8
## Prerequisites
6
9
7
10
To run this tutorial, you will need:
@@ -12,7 +15,7 @@ To run this tutorial, you will need:
12
15
13
16
## How to run the tutorial
14
17
15
-
1. Clone or download the project.
18
+
1. Clone or [download this project](https://github.com/talkjs/talkjs-examples/releases/latest/download/angular.angular-getting-started.zip).
16
19
2. Replace `<APP_ID>` in `src/app/talkjs-chat/talkjs-chat.component.ts` with the value found in the **Settings** tab of your [TalkJS dashboard](https://talkjs.com/dashboard/login).
Copy file name to clipboardexpand all lines: chatbot-integration/anthropic-claude/README.md
+6-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
+
# How to integrate Claude into your TalkJS chat with the Anthropic API
2
+
1
3
This is an example project for TalkJS's tutorial on [How to integrate Claude into your TalkJS chat with the Anthropic API](https://talkjs.com/resources/how-to-integrate-claude-into-your-talkjs-chat-with-the-anthropic-api/). The project uses TalkJS webhooks to listen for new message events from the TalkJS server, calls the Anthropic API to generate a message reply, and then adds the reply to the conversation with the TalkJS API.
2
4
5
+
> [!TIP]
6
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/chatbot-integration.anthropic-claude.zip)
7
+
3
8
## Prerequisites
4
9
5
10
To run this tutorial, you will need:
@@ -12,7 +17,7 @@ To run this tutorial, you will need:
12
17
13
18
## How to run the tutorial
14
19
15
-
1. Clone or download the project.
20
+
1. Clone or [download this project](https://github.com/talkjs/talkjs-examples/releases/latest/download/chatbot-integration.anthropic-claude.zip).
16
21
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).
17
22
3. Replace `<ANTHROPIC_SECRET_KEY>` with your Anthropic API key
18
23
4. Enable the `message.sent` option in the **Webhooks** section of the TalkJS dashboard.
Copy file name to clipboardexpand all lines: chatbot-integration/google-gemini/README.md
+6-1
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
+
# How to integrate Google's Gemini into your TalkJS chat
2
+
1
3
This is an example project for TalkJS's tutorial on [How to integrate Google's Gemini into your TalkJS chat](https://talkjs.com/resources/create-a-chatbot-with-talkjs-and-gemini/). The project uses TalkJS webhooks to listen for new message events from the TalkJS server, calls the Gemini API to generate a message reply, and then adds the reply to the conversation with the TalkJS API.
2
4
5
+
> [!TIP]
6
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/chatbot-integration.google-gemini.zip)
7
+
3
8
## Prerequisites
4
9
5
10
To run this tutorial, you will need:
@@ -12,7 +17,7 @@ To run this tutorial, you will need:
12
17
13
18
## How to run the tutorial
14
19
15
-
1. Clone or download the project.
20
+
1. Clone or [download this project](https://github.com/talkjs/talkjs-examples/releases/latest/download/chatbot-integration.google-gemini.zip).
16
21
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).
17
22
3. Replace `<GEMINI_SECRET_KEY>` with your Anthropic API key
18
23
4. Enable the `message.sent` option in the **Webhooks** section of the TalkJS dashboard.
Copy file name to clipboardexpand all lines: chatbot-integration/openai-chatgpt/README.md
+6-1
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,12 @@
1
+
# How to integrate a chatbot into your TalkJS chat with the OpenAI API
2
+
1
3
This is an example project for TalkJS's tutorial on [How to integrate a chatbot into your TalkJS chat with the OpenAI API](https://talkjs.com/resources/how-to-make-a-customizable-chatbot-frontend-with-talkjs-and-the-openai-api/).
2
4
3
5
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.
4
6
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)
9
+
5
10
## Prerequisites
6
11
7
12
To run this tutorial, you will need:
@@ -14,7 +19,7 @@ To run this tutorial, you will need:
14
19
15
20
## How to run the tutorial
16
21
17
-
1. Clone or download the project.
22
+
1. Clone or [download this project](https://github.com/talkjs/talkjs-examples/releases/latest/download/chatbot-integration.openai-chatgpt.zip).
18
23
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).
19
24
3. Replace `<OPENAI_SECRET_KEY>` with your OpenAI API key
20
25
4. Enable the `message.sent` option in the **Webhooks** section of the TalkJS dashboard.
This is an example project for TalkJS's tutorial on [how to integrate TalkJS with a Blazor app](https://talkjs.com/resources/how-to-add-chat-to-a-blazor-web-app-with-talkjs/).
4
4
5
5
This example demonstrates how to integrate TalkJS with a Blazor web application. There is one project present inside the repo:
6
6
7
7
- The `Blazor Web App` Interactive Server project which uses TalkJS's [JavaScript SDK](https://talkjs.com/docs/Getting_Started/JavaScript_SDK) to create a one on one chat.
8
8
9
+
> [!TIP]
10
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/csharp.blazor_talkjs.zip)
11
+
9
12
## Prerequisites
10
13
11
14
To run this tutorial project, you will need:
@@ -14,7 +17,7 @@ To run this tutorial project, you will need:
- A code editor like [Visual Studio Code](https://code.visualstudio.com/download) or IDE like [Visual Studio](https://visualstudio.microsoft.com/vs/community/)
16
19
17
-
1. Clone or download the project.
20
+
1. Clone or [download this project](https://github.com/talkjs/talkjs-examples/releases/latest/download/csharp.blazor_talkjs.zip).
18
21
1. Open the project in your code editor or IDE.
19
22
1. In the `Home.razor` page, replace `<APP_ID>` in the `AppId` string property with your App Id which can be found in the **Settings** tab of your [TalkJS dashboard](https://talkjs.com/dashboard/login).
20
23
1. From the `blazor_talkjs` directory, run the command `dotnet watch` to render your project on the browser.
Copy file name to clipboardexpand all lines: django/django_talkjs/README.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,9 @@
2
2
3
3
This is an example project for TalkJS's tutorial on [how to build a Django chat app with TalkJS](https://talkjs.com/resources/how-to-build-a-django-chat-app-with-talkjs/). This example demonstrates how to integrate TalkJS with a Python application that uses the Django framework.
4
4
5
+
> [!TIP]
6
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/django.django_talkjs.zip)
7
+
5
8
## Prerequisites
6
9
7
10
To run this tutorial, you will need:
@@ -11,7 +14,7 @@ To run this tutorial, you will need:
11
14
12
15
## How to run the tutorial
13
16
14
-
1. Clone or download the project.
17
+
1. Clone or [download this project](https://github.com/talkjs/talkjs-examples/releases/latest/download/django.django_talkjs.zip).
15
18
2. Replace `<APP_ID>` in `talkjs/templates/talkjs/chat.html` with the value found in the **Settings** tab of your [TalkJS dashboard](https://talkjs.com/dashboard/login).
This directory contains two games chat applications: one with and one without TalkJS integrated.
5
4
6
5
The application without chat functionality serves as a start application for the TalkJS implementation tutorial, in which chat functionalities are being added within a project. The final product of the tutorial is the games chat application with chat functionality.
7
6
8
-
## First things first
7
+
You can find additional information in the tutorial [How to add chat to a Django app with TalkJS](https://talkjs.com/tutorials/article/how-to-add-direct-messaging-to-a-discussion-forum-with-django-and-talkjs/).
9
8
10
-
### Python version
11
-
Make sure you're working with Python 3.7.4 or above.
12
-
You can download it from [here](https://www.python.org/).
9
+
> [!TIP]
10
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/django.gameschat.zip)
13
11
14
-
Make sure you tick the box that says 'Add Python to PATH'.
12
+
## Prerequisites
15
13
16
-
### PostgreSQL version
17
-
Make sure you're working with PostgreSQL 11.6 or above.
18
-
You can download it from [here](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads).
19
-
20
-
Through the installation you will be asked to enter a password for your database. In this example the password `gameschat` is used, but you can write whatever you want, just make sure to remember it because you will need it later.
14
+
-**Python version:** Make sure you're working with Python 3.7.4 or above. You can download it from [here](https://www.python.org/). Make sure you tick the box that says 'Add Python to PATH'.
15
+
-**PostgreSQL version:** Make sure you're working with PostgreSQL 11.6 or above. You can download it from [here](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads). You'll be asked to enter a password for your database. In this example the password `gameschat` is used, but you can write whatever you want. Just make sure to remember your password because you'll need it later.
21
16
22
17
## Getting started
18
+
23
19
The following steps should be executed in either the ```gameschat-with-talkjs``` or ```gameschat-without-talkjs``` directory.
24
20
25
21
- After the installation of PostgreSQL is done, start the `pgAdmin` which will open the database in your browser. Enter the password you chose during the installation. Expand the Servers section from the `Browser` on the right (if asked enter the same password again). Right click on `Databases->Create->Database...`, then enter the name you want and click `Save`.
@@ -39,7 +35,8 @@ The following steps should be executed in either the ```gameschat-with-talkjs```
39
35
40
36
- After you've cloned/downloaded the repository, open the terminal in the project's directory and write `pip install -r requirements.txt`. After the installation is done, write `python manage.py migrate`. Lastly, write `python manage.py runserver`, this will start the server on port 8000. Go ahead and write the following in your browser `http://localhost:8000`.
41
37
42
-
Good job! Additional information can be found in the [tutorial](https://talkjs.com/tutorials/article/how-to-add-direct-messaging-to-a-discussion-forum-with-django-and-talkjs/) of this application.
38
+
Good job!
43
39
44
40
## Documentation
41
+
45
42
For more information on how to integrate TalkJS into your projects, check out our [documentation](https://talkjs.com/docs/?ref=gh-example-readme).
Copy file name to clipboardexpand all lines: flask/README.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,8 @@ This is an example project for TalkJS's tutorial on [how to build a Flask chat a
4
4
5
5
This example demonstrates how to integrate TalkJS with a Python application that uses the Flask framework. There are two projects present inside the repo:
6
6
7
-
-The `talkjs-flask-python`project contains the Flask backend, which serves a REST endpoint with user data.
8
-
-The `talkjs-frontend`project contains the frontend code, which uses TalkJS's [JavaScript SDK](https://talkjs.com/docs/Reference/JavaScript_Chat_SDK/) to create chats between users.
7
+
-`talkjs-flask-python`: This project contains the Flask backend, which serves a REST endpoint with user data.[Download `talkjs-flask-python` as a zip file.](https://github.com/talkjs/talkjs-examples/releases/latest/download/flask.talkjs-flask-python.zip)
8
+
-`talkjs-frontend`: This project contains the frontend code, which uses TalkJS's [JavaScript SDK](https://talkjs.com/docs/Reference/JavaScript_Chat_SDK/) to create chats between users.[Download `talkjs-frontend` as a zip file.](https://github.com/talkjs/talkjs-examples/releases/latest/download/flask.talkjs-frontend.zip)
9
9
10
10
## Prerequisites
11
11
@@ -16,7 +16,7 @@ To run this tutorial, you will need:
16
16
17
17
## How to run the tutorial
18
18
19
-
1. Clone or download the project.
19
+
1. Clone or download the project (as zip files: [`talkjs-flask-python`](https://github.com/talkjs/talkjs-examples/releases/latest/download/flask.talkjs-flask-python.zip) and [`talkjs-frontend`](https://github.com/talkjs/talkjs-examples/releases/latest/download/flask.talkjs-frontend.zip)).
20
20
1. From the `talkjs-flask-python` directory:
21
21
1. Run `pip install flask` and `pip install flask-cors` to install the dependencies
22
22
1. Run `python3 flask-python.py` to run the project
An example project that shows both the ChatBox and ConversationList widgets of TalkJS
3
+
An example project that shows both the [ChatBox](https://talkjs.com/docs/Reference/Flutter_SDK/Widgets/Chatbox/) and [ConversationList](https://talkjs.com/docs/Reference/Flutter_SDK/Widgets/ConversationList/) widgets of TalkJS.
4
4
5
-
## Getting Started
5
+
> [!TIP]
6
+
> [Download this example project as a zip file](https://github.com/talkjs/talkjs-examples/releases/latest/download/flutter_sdk.basic-example.zip)
7
+
8
+
## Getting started
6
9
7
10
The first thing to do is to install all the dependencies with the command:
8
11
@@ -12,8 +15,7 @@ flutter pub get
12
15
13
16
This is to be done only once.
14
17
15
-
After that, change in the `lib/main.dart` file the 'YOUR_APP_ID' string with a
16
-
valid appId.
18
+
After that, change in the `lib/main.dart` file the 'YOUR_APP_ID' string with a valid appId.
17
19
18
20
Finally, connect an Android/iOS device or emulator and run:
19
21
@@ -27,29 +29,17 @@ to run the example.
27
29
28
30
This example uses the 'provider' package to manage a global app state.
29
31
30
-
The `MyAppState` class has a `session` and a `conversation` properties, that
31
-
are used by the ChatBox and ConversationList widgets.
32
+
The `MyAppState` class has a `session` and a `conversation` properties, that are used by the ChatBox and ConversationList widgets.
32
33
33
-
The `conversation` property is in reality a getter and setter pair, in order
34
-
to call the `notifyListeners()` functions whenever the `conversation` property
35
-
is changed.
34
+
The `conversation` property is in reality a getter and setter pair, in order to call the `notifyListeners()` functions whenever the `conversation` property is changed.
36
35
37
-
In our `main()` function the TalkJS Session is initialized, and is used as the
38
-
global app state.
36
+
In our `main()` function the TalkJS Session is initialized, and is used as the global app state.
39
37
40
38
The app has 3 routes:
41
-
'/' contains the buttons to select either a ChatBox or ConversationList
42
-
'/chatbox' is the ChatBox screen, and finally
43
-
'/conversationlist' is the ConversationList screen.
44
-
45
-
The ChatBoxScreen uses Consumer<MyAppState> in order to get the global session
46
-
and conversation objects, and be able to rebuild itself whenever the global
47
-
state changes.
39
+
- '/' contains the buttons to select either a ChatBox or ConversationList
40
+
- '/chatbox' is the ChatBox screen, and finally
41
+
- '/conversationlist' is the ConversationList screen.
48
42
49
-
The ConversationList has an event called `onSelectConversation` that is
50
-
triggered when the user clicks on a conversation.
51
-
When the event is triggered, a new `Conversation` object is built, using the
52
-
`id` ov the selected conversation, then this object is assigned to the global
53
-
app state, and finally we navigate to the '/chatbox' route to show a ChatBox
54
-
widget with the selected conversation.
43
+
The ChatBoxScreen uses Consumer<MyAppState> in order to get the global session and conversation objects, and be able to rebuild itself whenever the global state changes.
55
44
45
+
The ConversationList has an event called `onSelectConversation` that is triggered when the user clicks on a conversation. When the event is triggered, a new `Conversation` object is built, using the `id` of the selected conversation, then this object is assigned to the global app state, and finally we navigate to the '/chatbox' route to show a ChatBox widget with the selected conversation.
0 commit comments