@ambassify/eventbus-client
v6.1.3
Published
API Client for eventbus service
Downloads
106
Readme
EventBus-client
A client to publish events to eventbus
.
Installation
npm install --save eventbus-client
Usage
const { Client } = require('eventbus-client');
const eventbus = new Client({
baseUrl: 'https://eventbus-endpoint'
});
eventbus.send('event_name', payload, options);
new EventBus()
new EventBus({ endpoint, [token, tokenType], [timeout] })
- endpoint: The endpoint of the eventbus service.
- token: The accessToken to use when none was set for the
.send()
call. - tokenType: The tokenType to use when setting the Authorization headerj.
- timeout: The duration for which events are batched before publishing them.
.send()
.send(eventName, payload, options)
- eventName: The event to publish. Example:
item_created
- payload: Any object that can be serialized using
JSON.stringify
- options: An object with any one of the following options set:
- orgId: The organization ID to publish to.
- userId: The user ID to publish to.
- id: The ID of the object in
payload
- type: The type of the object in
payload