55 < meta charset ="UTF-8 " />
66 < title > Hello BotScript!</ title >
77 < link rel ="icon " href ="data:, ">
8-
98 < link href ="https://fonts.googleapis.com/icon?family=Material+Icons " rel ="stylesheet ">
109 < link href ="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css " rel ="stylesheet ">
11- < link href ="https://widget.botscript.ai/styles.css " rel ="stylesheet ">
12-
1310 <!--link app scripts-->
1411 < script src ="https://play.botscript.ai/botscript.ai.js "> </ script >
1512 < script src ="https://play.botscript.ai/botscript.plugins.js "> </ script >
16- < script src ="https://widget.botscript.ai/botscript-widget.js "> </ script >
17-
18- < style >
19- botscript-chatbox {
20- position : fixed;
21- bottom : 0 ;
22- right : 0 ;
23- }
24- </ style >
2513</ head >
2614
2715< body >
3119 < h1 class ="display-3 "> Hello, BotScript!</ h1 >
3220 < p > A text-based scripting language, dialog system and bot engine for Conversational User Interfaces</ p >
3321 < p >
34- < a class ="btn-primary btn-lg chat-box-toggle " href ="# " style ="float: none; " onclick ="toogleChatbox() " role ="button "> Chat Now »</ a >
35- < 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 >
22+ < a class ="btn-primary btn-lg " href ="https://v2.botscript.ai/#/register " target ="_blank "> Register Now »</ a >
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 >
3625 </ p >
3726 </ div >
3827 </ div >
3928 < div class ="container ">
40- < botscript-chatbox id ="chatbox " auto-reply ="false "> </ botscript-chatbox >
4129 < h2 id ="greeting "> Do you have any questions to ask BotScript?</ h2 >
4230 < p id ="messages "> </ p >
4331 </ div >
44-
32+ < div id ="fb-root "> </ div >
33+ < div id ="fb-customer-chat " class ="fb-customerchat "> </ div >
4534 < script >
4635 const { BotScript } = BotScriptAI ;
4736 const bot = new BotScript ( ) ;
4837 const urlParams = new URLSearchParams ( window . location . search ) ;
4938 const botId = urlParams . get ( 'bot' ) ;
50- const chatbox = document . getElementById ( 'chatbox' ) ;
51- console . log ( 'autoReply: ' , chatbox . autoReply ) ;
52- chatbox . autoReply = false ;
5339
5440 bot . parse ( '> addTimeNow' ) ;
5541 bot . parse ( `
@@ -105,19 +91,6 @@ <h2 id="greeting">Do you have any questions to ask BotScript?</h2>
10591 await sendBot ( bot . newRequest ( 'Show my list' ) ) ;
10692 } ) ;
10793
108- // add reply message
109- chatbox . addEventListener (
110- 'messageAdded' ,
111- async ( evt ) => {
112- const { text, type} = evt . detail ;
113- if ( type === 'sent' ) {
114- const request = bot . newRequest ( text ) ;
115- const reply = await bot . handleAsync ( request ) ;
116- chatbox . addReply ( { message : reply . speechResponse } ) ;
117- }
118- }
119- ) ;
120-
12194 /**
12295 * Send bot message and wait response.
12396 * */
@@ -135,12 +108,28 @@ <h2 id="greeting">Do you have any questions to ask BotScript?</h2>
135108 elem . innerHTML = message ;
136109 chatbox . append ( elem ) ;
137110 }
138-
139- function toogleChatbox ( ) {
140- chatbox . visible = ! chatbox . visible ;
141- }
142111 </ script >
143112
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 >
144133</ body >
145134
146135</ html >
0 commit comments