Skip to main content

Function

Your code needs to have a function called handler in a file called widget_function.py or widget_function.js. The function handler will take two arguments, event and context.

The function will be exposed at https://<your-widget-id>-api.komputee.com/test and https://<your-widget-id>-api.komputee.com/prod

Default Event

When you are calling your function from the browser the function will receive an event like this.

{
"version": "2.0",
"routeKey": "POST /test",
"rawPath": "/prod/test",
"rawQueryString": "",
"headers": {
"accept": "application/json, text/plain, */*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "de,en-US;q=0.7,en;q=0.3",
"content-length": "24",
"content-type": "application/json",
"host": "ckuvatjo157361mpards0vuj1-api.komputee.com",
"origin": "https://dashboard.komputee.com",
"referer": "https://dashboard.komputee.com/",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0",
"x-amzn-trace-id": "Root=1-616da715-7cbd037a4bb61e6074284836",
"x-forwarded-for": "33.86.83.50",
"x-forwarded-port": "443",
"x-forwarded-proto": "https"
},
"requestContext": {
"accountId": "074460953219",
"apiId": "1hzn0a8x7i",
"domainName": "ckuvatjo157361mpards0vuj1-api.komputee.com",
"domainPrefix": "ckuvatjo157361mpards0vuj1-api",
"http": {
"method": "POST",
"path": "/prod/test",
"protocol": "HTTP/1.1",
"sourceIp": "213.86.107.50",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0"
},
"requestId": "HacLcjdUliAEMgA=",
"routeKey": "POST /test",
"stage": "prod",
"time": "18/Oct/2021:16:55:49 +0000",
"timeEpoch": 1634576149872
},
"body": "{\"my-input-1\":\"default\"}",
"isBase64Encoded": false
}