Filter webhooks by request method

Using Functions to filter

How can you allow only POST requests go through? With Webhook Relay it’s easy to do any kind of webhook filtering with Functions.

Setting up the function

Often webhooks are sent as POST requests. However, sometimes you might be getting other requests to this endpoint (GET, PATCH, etc.), to filter them out, create a function:

if r.RequestMethod ~= "POST" then 
    -- request is not important, don't forward it

And attach it to the output (Go to the Bucket settings, then click on the destination and then select Transform tab).

Testing the Function

Once added, POST requests will come through:

curl -X POST

while PUT, GET and other request method webhooks:

curl -X POST