Skip to content

Commit f8860b9

Browse files
committed
add plugin facebook message chatbox
1 parent b5a1b43 commit f8860b9

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

demo.html

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ <h1 class="display-3">Hello, BotScript!</h1>
2020
<p>A text-based scripting language, dialog system and bot engine for Conversational User Interfaces</p>
2121
<p>
2222
<a class="btn-primary btn-lg" href="https://v2.botscript.ai/#/register" target="_blank">Register Now &raquo;</a>
23-
<iframe src="https://ghbtns.com/github-btn.html?user=yeuai&repo=botscript&type=star&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
23+
<iframe src="https://ghbtns.com/github-btn.html?user=yeuai&repo=botscript&type=star&count=true&size=large"
24+
frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
2425
</p>
2526
</div>
2627
</div>
2728
<div class="container">
2829
<h2 id="greeting">Do you have any questions to ask BotScript?</h2>
2930
<p id="messages"></p>
3031
</div>
31-
32+
<div id="fb-root"></div>
33+
<div id="fb-customer-chat" class="fb-customerchat"></div>
3234
<script>
3335
const { BotScript } = BotScriptAI;
3436
const bot = new BotScript();
@@ -108,6 +110,26 @@ <h2 id="greeting">Do you have any questions to ask BotScript?</h2>
108110
}
109111
</script>
110112

113+
<script>
114+
// fb-customer-chat.js
115+
var chatbox = document.getElementById('fb-customer-chat');
116+
chatbox.setAttribute("page_id", "104330261088219");
117+
chatbox.setAttribute("attribution", "biz_inbox");
118+
window.fbAsyncInit = function () {
119+
FB.init({
120+
xfbml: true,
121+
version: 'v11.0'
122+
});
123+
};
124+
125+
(function (d, s, id) {
126+
var js, fjs = d.getElementsByTagName(s)[0];
127+
if (d.getElementById(id)) return;
128+
js = d.createElement(s); js.id = id;
129+
js.src = 'https://connect.facebook.net/vi_VN/sdk/xfbml.customerchat.js';
130+
fjs.parentNode.insertBefore(js, fjs);
131+
}(document, 'script', 'facebook-jssdk'));
132+
</script>
111133
</body>
112134

113135
</html>

0 commit comments

Comments
 (0)