abalad / ngx-freshchat

FreshChat library for Angular

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
Claudio Suardi

πŸ’» πŸ“– πŸ‘€
Will Poulson
Will Poulson

πŸ’» πŸ“–

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

About

FreshChat library for Angular


Languages

Language:TypeScript 78.0%Language:JavaScript 14.4%Language:HTML 7.2%Language:CSS 0.4%