Skip to content

Latest commit

 

History

History
96 lines (67 loc) · 2.85 KB

README.md

File metadata and controls

96 lines (67 loc) · 2.85 KB

Angular Service Bot Package

@iomechs/angular-service-bot

Actions Status

npm version github stars License: MIT

npm downloads total npm downloads/month

A simple, easily to use package to use servicebot.io with Angular apps.

Demo

https://iomechs.github.io/angular-service-bot/demo

Docs

https://iomechs.github.io/angular-service-bot

Dependencies

Usage

Install the package in your project's folder by using npm or yarn:

npm install @iomechs/angular-service-bot --save

# OR

yarn add @iomechs/angular-service-bot -S

Import AngularServiceBotModule in your AppModule as below:

import { AngularServiceBotModule } from '@iomechs/angular-service-bot';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    AngularServiceBotModule, // <-- here
  ]
});

In your component:

import { Component } from '@angular/core';

@Component({
  selector: 'asb-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})

export class AppComponent {

  serviceBotParams = {
    servicebot_id: 'E0OQN0P0Dort',  // LIVE & TEST MODE IDs ARE DIFFERENT
    service: 'Flat Subscription',
    email: '[email protected]',
    handleResponse: async (payload) => {
      if (payload.event === 'create_subscription') {
        console.log('Response Object ', payload.response);
      }
    }
  };

  constructor() {}
}

In your template:

<div class="angular-service-bot">
  <io-angular-service-bot [serviceBotParams]="serviceBotParams"></io-angular-service-bot>
</div>

For further details related service bot params visit service bot params details page.

License

MIT © IOMechs