13 lines
451 B
Plaintext
13 lines
451 B
Plaintext
expectedSignature = split(to_string!(.headers."x-hub-signature-256"), "=")[1]
|
|
actualSignature = encode_base16(hmac(to_string!(.body), to_string!(.secrets.SANDBOX_CLIENT_SECRET)))
|
|
if actualSignature != expectedSignature {
|
|
null
|
|
} else {
|
|
body = parse_json!(.body)
|
|
value = body.entry[0].changes[0].value
|
|
if !is_nullish(value.statuses) && length!(value.statuses) > 0 {
|
|
value.statuses[0].recipient_id
|
|
} else {
|
|
value.contacts[0].wa_id
|
|
}
|
|
} |