Quick start
Learn how to use Sentry (estimated time: 10 mins)
Last updated
Learn how to use Sentry (estimated time: 10 mins)
Last updated
Sentry is real time alerting system designed to be easily integrated into existing DeFi apps.
In this quick start, you will learn the basics to configure your account, create your first users, create user's subscriptions and receive your first real time generated alerts.
You have an account
You have an API key
If you don't already have an account, you can contact us on https://www.aleno.ai
For windows user: CURL commands might need to be adapted using Invoke-WebRequest.
Sentry is deigned to send notifications with webhooks: It sends notifications with POST request to an URL that you can define and update. So the first step is to tell the system where to send notifications by setting up your webhook URL.
In this demo section, we will use a simple online tool (Webhook.site) to get a testing URL for your notifications:
Go to https://webhook.site/
Copy the provided URL
Keep this window open during all the following steps (we will use it to see incoming notifications)
In this section, we propose to use a test URL with Webhook.Site. For a real use case, you would use a URL from your own server to handle the logic of what to do with incoming notifications.
Once you have a test URL on which you can see incomming notifications, you need to give to sentry this URL. To set this URL on your account, you have to use the PUT
/account
API route. Run the following lines in your terminal:
Don't forget to replace YOUR_API_KEY by your actual API key and YOUR_WEBHOOK_URL by the URL from previous step.
Route documentation at Set your webhook URL.
You should see a success message in your terminal:
The next step is to create your users. A user is an entity that can have subscriptions to track metrics and receive notifications.
To create users, you can use the API POST
/users
route. In this example we will create one user named "Alice". Run the following command in your terminal:
In your terminal you should see the response your the newly created users. Keep the ID of created user, it will be used in next step (the ID corresponds to "YOUR_USER_ID" that you will get in the result. It will be a UUID string).
Route documentation at Create users
Now that you have a user, you can add a subscription on a metric to this user. A subscription tells the system "This user is following this metric, if the value changes too much, create an alert.".
In this example, we will create the following subscription: "If the total TVL on WETH changes by more than 0.0001 %, create and send an alert" (threshold is intentionally very low to test alerts).
To create this subscription, you can use the API POST
/subscriptions
route. Run the following command in your terminal:
Don't forget to replace YOUR_API_KEY by your actual API key and replace YOUR_USER_ID by the actual user ID you got from previous step.
In this example, the threshold is set to the minimum value. This is because we want to generate notifications so that you can quickly see the resulting notification without having to wait for a huge variation on this metric.
Route documentation at Create subscriptions. If you want to know all available metrics, check Get available metrics section.
The subscription we defined on previous step has a very low threshold, so a new alert should be quickly triggered. On Ethereum chain, 1 block is mined every 15 seconds on average. So after 15 seconds maximum, a new alert should be generated and sent to the URL we defined on step 1.
Open your Webhook.Site window from step 1, you should see an incoming POST request with an alert corresponding to the alert setting defined on previous step:
Alert data description under Alert section.
That's it ! You have successfully done the following actions:
set webhook URL
create user
create subscription to generate alerts for your users
received generated real time alerts
You can now delete your test user with the API DELETE
/users
route. Run the following command in your terminal:
Deleting a user deletes all its associated subscriptions. Route documentation under Delete users.
You can also reset your webhook URL to null (in step 2. it was set to a test URL) using the same route as step 2. Run the following command in your terminal: