How to use Snyk webhooks with Zapier
Integration example
Create a new Zap in Zapier.
Trigger
To access request headers, create a Catch Raw Hook trigger. This trigger provides the request payload as a string, so you must parse it to JSON.
You receive a webhook URL where you send requests.

Create a Webhook in Snyk using the API with the your-url URL.
The API responds with the new webhook.
You can ping a webhook to test the Zapier trigger.
Select a ping request from the list and map fields.

Action (validate a payload)
Create a JS Action to validate a payload:
"Code by Zapier" → "Run Javascript"

Map headers['X-Hub-Signature'] and payload string to the snippet variables.

This snippet adds an isValid: boolean variable to Zap fields.
Test the snippet, ensure isValid === true.

Action (parse a payload)
Create another action to parse the payload string into a format Zapier uses.
Create the same JS Action:
"Code by Zapier" → "Run Javascript", with the following field mapping:

And the following JS snippet:
Parse a request payload and map it to the Zap variables.
Action (format issues)
New issues are lists of objects. Zapier requires a list of strings. Format newIssues as string[].
Create one more JS Action:
"Code by Zapier" → "Run Javascript", and paste the following snippet:
Action (filter)
After providing all fields, decide whether to use the event.
To filter, create "Filter by Zapier" app:

Select a filter method.

Action (send a notification)
Access all fields to build a notification template. Send an email or choose other notification types.

Last updated
Was this helpful?

