Skip to content

IOMechs/angular-service-bot

Repository files navigation

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: 'test@gmail.com',
    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