# Webhooks

> Send a JSON or Slack notification when a file is uploaded, downloaded or deleted in a CloudRepo Maven, Python or npm repository.

## Overview

Webhooks allow you to send notifications to servers outside of CloudRepo whenever one of the following events occurs in a Maven, Python or npm repository:

- File Deletion
- File Download
- File Upload

> **Caution:** Docker repositories send no webhook events. The **Create a Webhook** form lists them, but a webhook attached to a Docker repository never fires: not on a push, a pull, or a delete. Attach a webhook to a Maven group’s member repositories, not to the group: a download through a group fires on the member that served it.

## Types of Webhooks

CloudRepo currently supports the following type of Webhooks:

- [JSON Webhooks](#json-webhooks)
- [Slack](#slack-integration)

Every webhook target must be an `https://` URL that resolves to a public host.

> **Note:** If you need additional webhook support, please [let us know](mailto:support@cloudrepo.io).

## JSON Webhooks

CloudRepo can be configured to POST a JSON payload to an HTTPS endpoint whenever a file event happens in a Maven, Python or npm repository.

Jump to [Creating a Webhook](#creating-a-cloudrepo-webhook) to get started.

## Slack Integration

To send events to a Slack channel, create an incoming webhook in your Slack workspace first, by following Slack’s guide, [Sending messages using incoming webhooks](https://api.slack.com/messaging/webhooks). Slack gives you a webhook URL. Then [create a CloudRepo webhook](#creating-a-cloudrepo-webhook) of type **Slack** and paste that URL as the **Webhook Target**. Treat the URL as a secret: whoever has it can post to your channel.

## Creating a CloudRepo Webhook

First, you’ll need to login to the [CloudRepo Administrator Portal](https://admin.cloudrepo.io).

From the side navigation panel, click **Webhooks**.

![The Webhooks page reads No webhooks configured.](/docs/_astro/shots/webhooks/1-no-webhooks.9636f8581c8b646e.png)

You’ll be presented with the list of webhooks. If this is your first, the page reads **No webhooks configured**.

Click **Create Webhook**.

![The Create a Webhook form: the repository, the webhook target, the type and the events.](/docs/_astro/shots/webhooks/2-create-form.f7255aa83e3002aa.png)

On the **Create a Webhook** screen, fill in:

- **Repository to Trigger Webhook**: the webhook fires for events in this repository.
- **Webhook Target**: for JSON, the `https://` URL that listens for an HTTP POST with a JSON body; for Slack, the webhook URL you copied from Slack.
- The webhook type: **JSON** or **Slack**.
- **Fire Webhook On the Following Artifact Events:** tick **Delete**, **Download**, **Upload**, or any of them.

Then click **Create Webhook**.

![maven-releases is chosen, the target is https://ci.example.com/hooks/cloudrepo, the type is JSON, and Upload and Delete are ticked.](/docs/_astro/shots/webhooks/3-details.4190dcccbeb7cb9a.png)

Upon successful completion, your webhook will now be listed in the list of webhooks:

![The new webhook is listed with its target.](/docs/_astro/shots/webhooks/4-listed.81cc5ba18406362b.png)

## Modifying a Webhook

At this time, CloudRepo doesn’t support modifying an existing webhook.

If you wish to add events to a particular webhook URL, simply create a new webhook with the additional events you wish to monitor.

If you wish to remove events from a particular webhook, delete the existing webhook and add a new webhook with the updated permissions.

## Deleting a Webhook

In order to delete a webhook, select it from the list of webhooks:

![The webhook's details, with Delete Webhook at the bottom.](/docs/_astro/shots/webhooks/5-details.c4c39a13cb6d6fac.png)

On the **Webhook Details** page, click **Delete Webhook**.

![Delete Webhook asks you to type the target URL to confirm.](/docs/_astro/shots/webhooks/6-confirm-delete.e97490f286fb17ec.png)

A confirmation window will pop up; confirm, and the webhook is permanently removed.

---

The page: https://www.cloudrepo.io/docs/manage/webhooks.html
