Skip to content

Commit 1b6b935

Browse files
committed
Update chatbox frontend example
1 parent 2f7cdaf commit 1b6b935

File tree

2 files changed

+53
-63
lines changed

2 files changed

+53
-63
lines changed
Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
<!DOCTYPE html>
22
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<title>Sendbird migration example</title>
7+
<meta name="description" content="" />
8+
<meta name="viewport" content="width=device-width, initial-scale=1" />
9+
</head>
310

4-
<head>
5-
<meta charset="utf-8" />
6-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7-
<title>TalkJS Node JS Integration</title>
8-
<meta name="description" content="" />
9-
<meta name="viewport" content="width=device-width, initial-scale=1" />
10-
</head>
11-
12-
<body>
13-
<script src="script.js" async defer></script>
14-
<script>
15-
(function (t, a, l, k, j, s) {
16-
s = a.createElement("script");
17-
s.async = 1;
18-
s.src = "https://cdn.talkjs.com/talk.js";
19-
a.head.appendChild(s);
20-
k = t.Promise;
21-
t.Talk = {
22-
v: 3,
23-
ready: {
24-
then: function (f) {
25-
if (k)
26-
return new k(function (r, e) {
27-
l.push([f, r, e]);
28-
});
29-
l.push([f]);
30-
},
31-
catch: function () {
32-
return k && new k();
11+
<body>
12+
<script src="script.js" async defer></script>
13+
<script>
14+
(function (t, a, l, k, j, s) {
15+
s = a.createElement("script");
16+
s.async = 1;
17+
s.src = "https://cdn.talkjs.com/talk.js";
18+
a.head.appendChild(s);
19+
k = t.Promise;
20+
t.Talk = {
21+
v: 3,
22+
ready: {
23+
then: function (f) {
24+
if (k)
25+
return new k(function (r, e) {
26+
l.push([f, r, e]);
27+
});
28+
l.push([f]);
29+
},
30+
catch: function () {
31+
return k && new k();
32+
},
33+
c: l,
3334
},
34-
c: l,
35-
},
36-
};
37-
})(window, document, []);
38-
</script>
39-
<!-- container element in which TalkJS will display a chat UI -->
40-
<div id="talkjs-container" style="width: 90%; margin: 30px; height: 700px">
41-
</div>
42-
</body>
43-
35+
};
36+
})(window, document, []);
37+
</script>
38+
<!-- container element in which TalkJS will display a chat UI -->
39+
<div
40+
id="talkjs-container"
41+
style="width: 90%; margin: 30px; height: 600px"
42+
></div>
43+
</body>
4444
</html>
Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
1+
const appId = "<APP_ID>"; // Replace with your app ID from the TalkJS dashboard
2+
13
Talk.ready.then(function () {
2-
var me = new Talk.User({
3-
id: "523915",
4-
name: "Mathew Jacob"
5-
});
6-
var other1 = new Talk.User({
7-
id: "523916",
8-
name: "Morgan Stanley"
9-
});
10-
var other2 = new Talk.User({
11-
id: "523917",
12-
name: "Shane Riley"
13-
});
14-
var other3 = new Talk.User({
15-
id: "523918",
16-
name: "Clyde Howell"
17-
});
4+
// Add users from example-data
5+
var alice = new Talk.User("alice-sendbird");
6+
var sebastian = new Talk.User("sebastian-sendbird");
7+
var nina = new Talk.User("nina-sendbird");
188
window.talkSession = new Talk.Session({
19-
appId: "YOUR_APP_ID",
20-
me: me
9+
appId: appId,
10+
me: alice,
2111
});
2212

13+
// Add conversation from example-data
2314
var conversation = window.talkSession.getOrCreateConversation(
24-
"sendbird_group_channel_229583953_53183fc50174e861b9a7d5c6684636dc94922349"
15+
"sendbird_group_channel_483424280_ac14e7e8e6d5b3bc2dd3979fb360ad432ae0d6e9"
2516
);
26-
conversation.setParticipant(me);
27-
conversation.setParticipant(other1);
28-
conversation.setParticipant(other2);
29-
conversation.setParticipant(other3);
17+
conversation.setParticipant(alice);
18+
conversation.setParticipant(sebastian);
19+
conversation.setParticipant(nina);
3020

3121
var chatbox = window.talkSession.createChatbox(conversation);
3222
chatbox.mount(document.getElementById("talkjs-container"));
33-
});
23+
});

0 commit comments

Comments
 (0)