-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathindex.html
79 lines (71 loc) · 2.03 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TalkJS tutorial</title>
</head>
<script>
(function (t, a, l, k, j, s) {
s = a.createElement("script");
s.async = 1;
s.src = "https://cdn.talkjs.com/talk.js";
a.head.appendChild(s);
k = t.Promise;
t.Talk = {
v: 3,
ready: {
then: function (f) {
if (k)
return new k(function (r, e) {
l.push([f, r, e]);
});
l.push([f]);
},
catch: function () {
return k && new k();
},
c: l,
},
};
})(window, document, []);
</script>
<script>
Talk.ready.then(function () {
const me = new Talk.User({
id: "autoReplyExampleUser",
name: "Sebastian",
email: "sebastian@example.com",
photoUrl: "https://talkjs.com/images/avatar-5.jpg",
role: "customer",
welcomeMessage: "Hi!",
});
const talkSession = new Talk.Session({
appId: "<APP_ID>", // replace with your app ID
me: me,
});
var other = new Talk.User({
id: "autoReplyExampleSupportAgent",
name: "Alice",
email: "alice@example.com",
photoUrl: "https://talkjs.com/images/avatar-1.jpg",
role: "support",
welcomeMessage: "Hey, how can I help?",
});
var conversation = talkSession.getOrCreateConversation(
"autoReplyExampleConversation"
);
conversation.setParticipant(me);
conversation.setParticipant(other);
const chatbox = talkSession.createChatbox();
chatbox.select(conversation);
chatbox.mount(document.getElementById("talkjs-container"));
});
</script>
<body>
<!-- container element in which TalkJS will display a chat UI -->
<div id="talkjs-container" style="width: 90%; margin: 30px; height: 500px">
<i>Loading chat...</i>
</div>
</body>
</html>