API Client for eventbus service
npm install @ambassify/eventbus-clientA client to publish events to eventbus.
``shell`
npm install --save eventbus-client
`javascript
const { Client } = require('eventbus-client');
const eventbus = new Client({
baseUrl: 'https://eventbus-endpoint'
});
eventbus.send('event_name', payload, options);
`
#### new EventBus()
`javascript`
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()
`javascript`
.send(eventName, payload, options)item_created
- eventName: The event to publish. Example: JSON.stringify
- payload: Any object that can be serialized using payload
- 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