Topics on this page

BriteEvents overview

BriteEvents enables external systems to send and receive events. An external system could be BriteCore as a site, a customer’s own system, or a vendor. Once the event is received, our products (Quote, Claims, IntegrationX, etc.) can react to that event.

Example: When a payment is made within Invoice Cloud’s system, you can send a message to BriteEvents with the data about the payment. BriteAccounting could listen for that event and record it in the GL.

Any customer can, through the API, create an event subscription (e.g., webhook) that allows BriteCore products to send events to a validated external system.

What events are available?

Create a subscription

To create an event subscription, you send a POST to /events/subscriptions with the URL to receive the events and the selector string of events you would like to subscribe to receive.

The JSON data is structured in JSON:API

View code

{"data": {

"type": "subscription",

"attributes": {

"url": "https://myorg.com/events",

"events": "bc.demo.event"

}

}}

The URL should implement the protocol described by AWS for subscribing to SNS over HTTPS. This is left to the subscriber to complete.

The event string selector determines which events are matched as they go through the event bus. AWS EventBridge is used for this and the possible pattern matching operations are detailed in the EventBridge documentation.

The creation of a subscription can take a few minutes. As such, an HTTP 202 ACCEPTED response code is returned in accordance with JSON:API. You can check the status of the subscription by querying the list subscription’s API. Only confirmed subscriptions are returned.

Select/Filter events

The events field of a subscription will only be applied to the source field of the event (the above AWS documentation refers to more than that).

Three common patterns are a string match, prefix match, and anything-but.

A string match is the full string of the source, whereby it’s the same in the event subscription and event; for example, bc.demo.event. “{“prefix”: “bc.policies”}”

Note: We automatically add brackets `[ ]` around the event string. Including them will cause an asynchronous error and your subscription will not become active.

Publish an event

External systems may publish events into BriteCore using the publishing endpoint.

Send a POST to /events/ with a payload of:

View code

{

"data": {

"type": "event",

"attributes": {"source": "home.brewed.event", "detail": {"what": "ever"}}

}

}

The detail must be JSON compatible and less than 256 KB.

Publish an event greater than 256 KB

Events greater than 256 KB must be sent with an upload: true attribute.

View code

{

"data": {

"type": "event",

"attributes": {"source": "home.brewed.event", "detail": {}, "upload": "true"}

}

}

The response will contain a pre-signed S3 link in the Location header, where you must upload the event payload (that which otherwise would have gone in the detail attribute).

Limits

Size

Events greater than 256 KB must be sent with an upload: true attribute. The sender may follow this example to roughly determine the size of the event. Sending events with payloads greater than 256 KB will fail to be published if the upload attribute is missing.

Subscriptions

Leveraging several AWS products, subscriptions take about a minute or two before events start to be delivered. This assumes that the response to the initial SNS delivery request is automatically handled. After approximately 12.5 minutes, without a successful response, attempts to create the subscription will cease.

After deleting a subscription, it may take up to a few seconds before events stop being delivered. The subscription is removed from being listed in less than a second.

Subscriptions are limited to unique URLs and event selectors, for example, example.com, and bc.demo.event can’t be used to subscribe multiple times. An HTTP 409 CONFLICT response code will be given when attempting to do so.