How to open the Facebook Messenger Customer Chat Plugin from another button?

I am implementing the Facebook chat plugin on a website, where it renders an iframe on the page. I would like to know if it is possible to use a button on my page to do the same action as the button that opens the chat in the iframe...

insert the description of the image here

I tried to move the iframe into the link but had no success because the button loses functionality, follows the code i implemented:

//pega o iframe
var getBtChat = $(".fb_dialog.fb_dialog_advanced");

//remove da pagina
$(".fb_dialog.fb_dialog_advanced").remove();

//coloca dentro do link
$("a#btFacebook").append(getBtChat);

All help is welcome...

Author: Charles Fay, 2018-02-19