For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to use Snyk webhooks with Zapier

How to use Snyk webhooks with Zapier

Snyk API v1 docs are in the Reference.

​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.

Zapier trigger step showing the generated webhook URL

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.

Selecting a ping request from the list and mapping its fields

Action (validate a payload)

Create a JS Action to validate a payload:

"Code by Zapier" → "Run Javascript"

Creating a JavaScript action to validate the webhook payload

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

Mapping the signature header and payload string to the snippet variables

This snippet adds an isValid: boolean variable to Zap fields.

Replace my-secret-string string with a webhook's secret string.

Test the snippet, ensure isValid === true.

Test result for the validation snippet

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:

Creating a JavaScript action to parse the webhook payload

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:

Adding the Filter by Zapier app as an action

Select a filter method.

Selecting a filter method

Action (send a notification)

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

Building a notification template from the parsed webhook fields

Last updated

Was this helpful?