Alerts
Learn how to react on events.
LiveSession event stream was designed to be a powerful tool helpful for example in monitoring and alerting purposes. It allows you to react on events in real-time and take actions based on them.
Quickstart
Alerts delivery can be configured in two ways. First, you can use third party delivery provider like Slack
.
Second, you can set up a custom workflow using webhooks. All methods receive events in real-time.
import livesession from "livesession" const ls = new livesession( livesession.optionApiKey(process.env.LIVESESSION_PAT) ) await ls.webhooks.create({ website_id: "YOUR_WEBSITE_ID", url: "YOUR_WEBHOOK_URL", version: "v1.0", })
Once you have a webhook set up, you can create an alert to receive events in real-time.
The main duty of alerts is to filter events and send them to the configured delivery provider. You can for example create a custom event and based on that event send a message to your server.
Creating an alert
Alerts gives you a robust control which events you want to receive.
You can use built-in events like Error Click
, Network Error
or based on custom event which gives you a full control of
what and when you want to monitor.
import livesession from "livesession" const ls = new livesession( livesession.optionApiKey(process.env.LIVESESSION_PAT) ) await ls.alerts.create({ name: "YOUR_ALERT_NAME", provider: "webhooks", webhook_id: "YOUR_WEBHOOK_ID", events: [ { kind: 26, value: "YOUR_CUSTOM_EVENT_NAME" } ] })
Based on above example, please make sure you used custom event tracking like
ls.track("YOUR_CUSTOM_EVENT_NAME")
Show your support! Star us on GitHub ⭐️