Securing Mechanic webhooks
Generating signatures
<script>
$.post(
'https://usemechanic.com/webhook/000000000',
{
customer_id: {{ customer.id | json }},
customer_id_signature: {{ customer.id | hmac_sha256: "some-secret-value" | json }}
}
);
</script>{% assign customer_id = event.data.customer_id %}
{% assign customer_id_signature = event.data.customer_id_signature %}
{% assign expected_customer_id_signature = customer_id | hmac_sha256: "some-secret-value" %}
{% if expected_customer_id_signature != customer_id_signature %}
{% error "Customer ID signature did not match." %}
{% endif %}Preventing replay attacks
Using idempotent task code
Adding time to the request signature
Last updated
Was this helpful?