Previously we looked at Event Types, these are templates describing the different types of insights/notifications a business might want to see. They describe the structure of what needs to be displayed as part of a given Event Type along with any placeholders (e.g. {{location}} or {{customerFirstName}}.
Events are the actual, literal alerts/notifications that flow into your Control Room.
So using the Event Type we created previously (Customer Flying), actual events would look something like this:
You can see this is based on the same Event Type we created earlier. But they contain actual information inside of the placeholders.
We can create Events in two ways, via UI or API. In some cases, it makes sense to allow users to post Events via a UI, in other (and most cases) it makes sense to stream events via APIs. We’ll walk you through both.
Creating Events - Using the interface
The Hero Regulator expects Pharmacies to register customers who take the Hero Flight potion and take flight successfully. In this case, Pharma’s simply open their Control Room and raise an alert within the system.
The process is quite straightforward:
Open the Control Room you created in the previous step (Heroes Flying Potion - Real-time Monitoring)
In the side panel, click ‘Post an Event’
Select the Event Type we’d like to post to, in this case “Customer Flying”
Fill in the placeholders with the actual location and name
Post the event!
Now you can go into your Control Room and see the events in your event stream.
Here’s a quick visual walk through:
Creating Events - Using the API
The process is essentially the same. Instead of selecting Event Types from a list as we did previously, we need to reference our Event Type’s Unique Identifier.
Getting this is easy:
Head over to ‘Manage Event Types’ in your Control Room
Open the Event Type of interest (e.g. Customer Flying)
Navigate to the ‘Event Type Schema’ tab
Here you’ll find a bunch of useful information for developers, for example, the endpoint you can POST events to, as well as the schema to use when posting events
Here’s a visual walk through of how to get this:
Now we’re ready to make some calls and push events via API:
Creating Event - Flying Person Detected in Central Park
The output within the Sky Ledge control room should look like this:
When creating an event, it’s expected that an empty response is returned. If you consider situations such as streaming real-time data from an ioT device, it’s doesn’t make much sense to wait for the device to respond before setting up the event in our account
Creating Event - Customer Flying in Garment District
And last but not least, the potion ineffective event will look like this on our platform:
Special Powers - Creating Geofences
Here’s a little secret, developers have a lot more flexibility with the types of events they can generate. Instead of a simple marker, you could create Events that specify a geofence using simple GeoJSON, check this out: