Events
Events are the core offering of the SDAPI platform. Learn how to communicate with our API to create and monitor your events.
The event model
The event model contains all the information about what is happening in your online business. All events contain a title, subtitle, and can include any additional metadata you may find important to log.
Properties
- Name
id- Type
- string
- Description
Unique identifier for the event.
- Name
workspace_id- Type
- string
- Description
The id of the workspace the event belongs to.
- Name
title- Type
- string
- Description
The primary title for the event.
- Name
subtitle- Type
- string
- Description
The message to display, providing more detail about the event.
- Name
context- Type
- object
- Description
An arbitrary object containing additional information or metadata about the event; useful for associating events with your internal database records.
- Name
actions- Type
- array
- Description
A list of actions that can be performed manually or automatically when an event is created.
- Name
created- Type
- timestamp
- Description
Timestamp of when the event was created on the platform.
- Name
timestamp- Type
- timestamp
- Description
Timestamp of the API response.
Create an event
This is arguably the most important endpoint, allowing you to add a new event to your currently authenticated workspace.
Required attributes
- Name
title- Type
- string
- Description
THe primary title for the event.
- Name
subtitle- Type
- string
- Description
The message to display, providing more detail about the event.
- Name
topics- Type
- array
- Description
A list of topics to associate with the event. If the topic does not exist, it will be created automatically.
Optional attributes
- Name
actions- Type
- string
- Description
The avatar image URL for the event.
- Name
context- Type
- string
- Description
The event display name in the event list. By default, this is just the title.
Request
curl https://api.observli.com/events \
-H "Authorization: Bearer {token}" \
--data-raw '{
"title": "User event",
"subtitle": "Triggered by peter@parker.com",
"context": {
"userId": 1,
"name": "Peter Parker",
"ip": "1.1.1.1"
},
"topics": ["users"]
}'
Response
{
"id": "56dkkly",
"workspace_id": "jpl056m",
"title": "User event",
"message": "Triggered by peter@parker.com",
"context": {
"userId": 1,
"name": "Peter Parker",
"ip": "1.1.1.1"
},
"actions": [],
"topics": ["users"],
"created": 1698175847,
"timestamp": 1698175847
}
Retrieve an event
This endpoint allows you to retrieve a event by providing the id of the model. Refer to the list at the top of this page to see which properties are included with event objects.
Request
curl https://api.observli.com/events/56dkkly \
-H "Authorization: Bearer {token}"
Response
{
"data": {
"id": "56dkkly",
"workspace_id": "jpl056m",
"title": "User event",
"subtitle": "Triggered by peter@parker.com",
"context": {
"ip": "1.1.1.1",
"name": "Peter Parker",
"userId": 1
},
"actions": [],
"topics": ["users"],
"created": 1698175847,
"timestamp": 1698258310
}
}
Update an event
This endpoint allows you to perform an update on a event.
Optional attributes
- Name
title- Type
- string
- Description
The primary title for the event.
- Name
subtitle- Type
- string
- Description
The message to display, providing more detail about the event.
- Name
context- Type
- object
- Description
An arbitrary object containing additional information or metadata about the event; useful for associating events with your internal database records.
Request
curl -X PUT https://api.observli.com/events/56dkkly \
-H "Authorization: Bearer {token}" \
-d subtitle="Updated event subtitle"
Response
{
"id": "56dkkly",
"workspace_id": "jpl056m",
"title": "User event",
"subtitle": "Updated event subtitle",
"context": {
"userId": 1,
"name": "Peter Parker",
"ip": "1.1.1.1"
},
"actions": [],
"topics": ["users"],
"created": 1698175847,
"timestamp": 1698175847
}
Delete an event
This endpoint allows you to delete events from your event list in SDAPI. Note: This will also delete all actions associated with the event.
Request
curl -X DELETE https://api.observli.com/events/56dkkly \
-H "Authorization: Bearer {token}"
List all events
This endpoint allows you to retrieve a list of all your recent events. By default, all events will be returned.
Optional attributes
- Name
limit- Type
- integer
- Description
Limit the number of events returned.
Request
curl -G https://api.observli.com/events \
-H "Authorization: Bearer {token}" \
-d active=true \
-d limit=10
Response
{
"data": [
{
"id": "56dkkly",
"workspace_id": "jpl056m",
"title": "User event",
"subtitle": "Triggered by peter@parker.com",
"context": {
"ip": "1.1.1.1",
"name": "Peter Parker",
"userId": 1
},
"actions": [],
"created": 1698175847,
"timestamp": 1698203404
},
{
"id": "2a1b2c3",
// ...
}
]
}