Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new Messenger Customer Chat SDK #149

Open
gbertoncelli opened this issue Feb 27, 2019 · 5 comments
Open

Add support for new Messenger Customer Chat SDK #149

gbertoncelli opened this issue Feb 27, 2019 · 5 comments

Comments

@gbertoncelli
Copy link

It would be nice to add to this package the possibility to integrate the new Customer chat SDK platform. Right now this can be added only manually with plain javascript because the sdk.js is no more valid for this platform and instead another script has to be loaded and in case someone has only to integrate the Messenger in the Angular application this package appear to be useless.

image

Complete documentation of the customer chat platform can be found here.

@craigcosmo
Copy link

@HighSoftWare96 Do you have workaround?

RIght now I'm using this.facebookService.CustomerChat.showDialog(); it give me error showDialog() is undefined. I guess because of this issue ?

@gbertoncelli
Copy link
Author

Sorry but the only workaround I've found was to use the embed chat code inside the index file...

@craigcosmo
Copy link

craigcosmo commented Jul 24, 2019

@HighSoftWare96 Thanks.

I put the init code in the index.html

<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>
	window.fbAsyncInit = function() {
		FB.init({
			xfbml: true,
			version: 'v3.3',
		})
	}
	;(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.net/vi_VN/sdk/xfbml.customerchat.js'
		fjs.parentNode.insertBefore(js, fjs)
	})(document, 'script', 'facebook-jssdk')
</script>

<!-- Your customer chat code -->
<div
	class="fb-customerchat"
	attribution="setup_tool"
	page_id="2629140093930438"
	theme_color="#0084ff"
></div>

Then in my components, I use it like this

userClickBanner(){
	FB.CustomerChat.showDialog()
}

And I got the error

ERROR in src/app/modules/product/list/list.ts(207,4): error TS2304: Cannot find name 'FB'.

I miss something? The FB var supposed to be global right?

@gbertoncelli
Copy link
Author

gbertoncelli commented Jul 25, 2019 via email

@SkyZeroZx
Copy link

Currently create a dedicate library for Messager Chat of Facebook
If you are interested you could see it here in NPM with its documentation or github

https://www.npmjs.com/package/ngx-facebook-messenger

https://github.com/SkyZeroZx/ngx-facebook-messenger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants