Python Webhook Example

Alerting and Reporting

NetCloud Feature
Monitoring and Diagnostics > Alerts and Logs
ft:locale
en-US
ft:sourceName
Paligo_Prod
import hmac
def lambda_handler(event, context):
    body = event["body"] or " "
    headers = event["headers"]
    ret = 200
    secret = "__super secret__"
    h = hmac.new(secret.encode("utf-8"), body.encode("utf-8"), "sha256")
    signature = h.hexdigest()
    if signature != headers["x-cp-signature"]:
        ret = 403
    else:
        ret = 200   
    return {
        'statusCode': ret
    }