---
title: Working with Events and presignedUrl
slug: monitor/working-with-events-and-presignedurl
docTags: 
createdAt: 2025-06-12T07:58:20.982Z
---

**Events and presignedUrl&#x20;**&#x72;equires partners to provide webhook for Klavi event reception, and proactively obtain analysis result files based on the `presignedUrl` in the event.

## 1.Configure the webhook for event reception

Partners need to configure the following information in the [Console](https://console.klavi.ai):

- **Webhook for event reception**

The above information can also be provided to Klavi [business personnel](mailto\:crie@klavi.ai) for Klavi to fill in.

## 2.Passive reception and parse events through webhook

After Klavi completes the data analysis, it will send notifications to the configured webhooks.

```json
{
    "partnerCode": "renner",
    "eventId": "1495468585434-0e73d1719173766fe4dfe1a8",
    "eventType": "monitor",
    "eventName": "monitor_finished",
    "eventTime": "2025-02-26T20:08:17.848Z",
    "payload":
    {
        "monitorId": "f0581ab0-d133-4f28-bfff-0039c8e3b882",
        "presignedUrl": "https://amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAEXAMPLE123456789%2F20210621%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210621T041609Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=EXAMBLE1234494d5fba3fed607f98018e1dfc62e2529ae96d844123456",
        "resultId": "aeec732f-08c0-4227-98a7-61f9be1783e1"
    }
}
```

Parse the above event and obtain the `presignedUrl` of the sharing file.

```html
https://amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAEXAMPLE123456789%2F20210621%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210621T041609Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=EXAMBLE1234494d5fba3fed607f98018e1dfc62e2529ae96d844123456
```

## 3.Retrieve sharing result data through presignedUrl

:::CodeblockTabs
```bash
wget -O <output-file-name> https://amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAEXAMPLE123456789%2F20210621%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210621T041609Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=EXAMBLE1234494d5fba3fed607f98018e1dfc62e2529ae96d844123456
# or
curl -o <output-file-name> https://amzn-s3-demo-bucket.s3.us-west-2.amazonaws.com/key?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAEXAMPLE123456789%2F20210621%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210621T041609Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=EXAMBLE1234494d5fba3fed607f98018e1dfc62e2529ae96d844123456
```

```python
import requests

presigned_url = "https://<bucket-name>.s3.<region>.amazonaws.com/<object-key>?AWSAccessKeyId=...&Expires=...&Signature=..."

response = requests.get(presigned_url)

if response.status_code == 200:
    with open("downloaded_file", "wb") as file:
        file.write(response.content)
    print("download successful")
else:
    print(f"download failed，statue_code: {response.status_code}")
```
:::

:::hint{type="info"}
The default lifecycle of `presignedUrl` is 7 day, starting from `eventTime`. Partners need to complete file retrieval before the end of the lifecycle, otherwise the URL will become invalid.
:::

