Messenger Extensions JS SDK Reference

The Messenger Extensions SDK gives you the ability to tightly integrate experiences in the webview with the Messenger experience by making added functionality accessible in the webview.

Including the SDK

To make the Messenger Extensions SDK available in the webview, you must whitelist the domains for all sites that will use the SDK, and include the SDK in your site with the following script:

(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 = "https://connect.facebook.com/en_US/messenger.Extensions.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'Messenger'));

For complete details, see Add Messenger Extensions SDK.