Skip to content

beyondsanity/ngx-freshchat

Repository files navigation

NgxFreshchat

Angular Wrapper for Freshchat js library. It requires Angular 6 or above.

Installation

Run npm install ngx-freshchat.

Import the library inside your desired module:

@NgModule({
    imports: [
        ...
        NgxFreshChatModule
        ...

Usage

Import the service and launch the init command:

constructor(private chat: NgxFreshChatService) {}

ngOnInit() {
    this.chat.init({
        token: YOUR_FC_TOKEN,
        host: YOUR_FC_URL
    })
    .subscribe(
        () => console.log('FreshChat is ready!')
    );
}

The library tries to mimic all the original properties and method names, but I made the methods respond with observables in order to allow checking the status of your requests. For more info please refer to the official documentation.

NB: The methods from the "user" object are mapped directly in the service. (i.e. window.fcWidget.user.setProperties() from the js is mapped as this.chat.setUserProperties() )

Contributions are welcome.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Claudio Suardi

💻 📖 👀

Will Poulson

💻 📖

Robson Jean Penteado

💻

This project follows the all-contributors specification. Contributions of any kind welcome!