DEVELOPER GUIDE
Working with Events and presignedUrl
4 min
events and presignedurl requires 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 webhook for event reception the above information can also be provided to klavi business personnel 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 { "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 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 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=examble1234494d5fba3fed607f98018e1dfc62e2529ae96d844123456import 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}") 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