DEVELOP GUIDES
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 events receiving method(push/pull) webhook for event reception(if push events method) encryption options(yes/no) the above information can also be provided to klavi business personnel for klavi to fill in 2 passive reception or active polling and parse events through webhook after klavi completes the data analysis, it will send notifications to the configured webhooks { "partnerappid" "12345678", "eventid" "1495468585434 0e73d1719173766fe4dfe1a8", "eventtype" "analysis", "eventname" "analysis finished", "eventtime" "2025 02 26t20 08 17 848z", "payload" { "batchid" "25872252137", "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" } } 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 1 day (24 hours), starting from eventtime partners need to complete file retrieval before the end of the lifecycle, otherwise the url will become invalid