javascript - Facebook Send-To-Messenger Event Listeners -


facebook launched cool, i've been trying figure out how page redirect on user clicking , opt-in. now, not java, php thing.

reference : https://developers.facebook.com/docs/messenger-platform/plugin-reference/send-to-messenger#event

working code :

fb.event.subscribe('send_to_messenger', function(e) { // callback events triggered plugin console.log('inside send_to_messenger');   window.top.location = 'http://google.com'; }); 

that kick out console.log , redirect, want do when user clicks button , triggers opt-in send_to_messener button.

so tried

fb.event.subscribe('clicked', function(e) { // callback events triggered plugin console.log('user clicked button');   window.top.location = 'http://google.com'; }); 

--- ---

fb.event.subscribe('send_to_messenger', function(e) { fb.event.subscribe('clicked', function(e) { // callback events triggered plugin console.log('user clicked button');   window.top.location = 'http://google.com'; }}); 

again, nothing worked - if has clue point in right direction, appreciate .. thanks!!

after looking @ again, figured out.

if (response.is_after_optin == true ){ // } 

Comments