$ cnpm install @kikstart-playground/graphql-intercom
GraphQL Intercom module for NestJS
Install @kikstart-playground/graphql-intercom
from npm:
npm i @kikstart-playground/graphql-intercom
# or
yarn add @kikstart-playground/graphql-intercom
Add the module to your NestJS API:
// Import the module
import { GraphQLIntercomModule } from '@kikstart-playground/graphql-intercom'
// Import the PubSub you like to use
import { PubSub } from 'apollo-server-express'
@Module({
imports: [
//...other imports
// Import the module and provide an instance of PubSub
GraphQLIntercomModule.forRoot({ pubSub: new PubSub() }),
],
})
export class AppModule {}
Use the following queries to interact with the intercom:
fragment IntercomMessageDetails on IntercomMessage {
type
scope
payload
}
mutation IntercomPub($type:String! $scope: String $payload: JSON) {
intercomPub(type: $type scope: $scope payload: $payload) {
...IntercomMessageDetails
}
}
subscription IntercomSub($type:String $scope: String) {
intercomSub(type: $type scope: $scope) {
...IntercomMessageDetails
}
}
Copyright 2014 - 2017 © taobao.org |