How to Integrate Facebook Chat if you Already Call the SDK
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
To initiate the setup for the Messenger Chat widget Heyday performs a call to retrieve a Facebook SDK. However, if you already are making that call for another function of your website itβs important that both call from the same SDK, otherwise one or more of the scripts wonβt be allowed to initiate.
If youβre looking to integrate the Messenger Chat option into your website but youβre required to Call the Facebook SDK for another function on your web page, you can follow these steps to help you set both your website and the chat widget up for success:
Rather than asking you to load the SDK, Heyday will load the Customer Chat SDK for you, which can be used for all SDK functions, this includes the chat function.
Specifically, donβt call <script src="//connect.facebook.net/en_US/all.js"></script> as this will not initiate the Customer Chat function.
Rather than define window.fbAsyncInit; we ask you to define window.hdAsyncInit instead (see example below) before loading Heyday, we will call this function once the chat is initialized
You can integrate your snippet to setup Heyday chat here
When hdAsyncInit is called, you can continue calling FB.init as you were prior to integrating the Heyday snippet
Example:
window.hdAsyncInit = clientAsyncInit;
<script>https://api.heyday.ai/v130/xxx/yyy/zz_ZZ/setupchat.js</script>
function clientAsyncInit() {
FB.init({
appId: appId,
xfbml: true,
version: 'v7.0',
status: true // set to true to refresh status on every load
});
// continue calling Facebook
}