Solved
Facebook Messenger Bot script
Hi, we wish to include a Facebook Messenger Bot script within a question in our survey but after inserting the script into the question's HTML view, we have mixed results - several times the FB messenger button has displayed correctly on the survey page, other times it doesn't appear at all, and often when re-opening the HTML view to check the script, it has vanished.
The script we have is:
<script> window.fbMessengerPlugins = window.fbMessengerPlugins || { init : function() { FB.init({ appId: "<OUR APP ID>", xfbml: true, version: "v3.0" }); }, callable : [] }; window.fbAsyncInit = window.fbAsyncInit || function() { window.fbMessengerPlugins.callable.forEach( function( item ) { item(); } ); window.fbMessengerPlugins.init(); }; setTimeout( function() { (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) { return; } js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); }, 0); </script> <div class="fb-send-to-messenger test-fb-send-to-messenger" messenger_app_id="<OUR APP ID>" page_id="<PAGE ID>" data-ref="" color="blue" size="large"> </div>
_(OUR APP ID and PAGE ID are numbers within the live version)_
Any ideas why this isn't working? Do we need to set it up in another way?
Thanks so much in advance for any help!
Best,
Steve
Best answer by TomG
Instead of putting it in the question's HTML, try putting it in the addOnReady function under JavaScript.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
