# Webhooks

> Source: https://parallelworks.com/docs/organization-admin/settings/webhooks

# Webhooks

This page explains how to add webhooks to your organization. Webhooks allow external services to be notified when certain events happen. When the specified events happen, we'll send a POST request to each of the URLs you provide.

## Adding a Webhook

From the **Organizations** list, select your organization. In the sidebar, under **Settings**, click **Webhooks**.

Click **+ Add Webhook**.

On the next page, select a **Type**. Currently, you can choose from these webhook types:
- `USER_CREATED` flags when a new user logs in for the first time.
- `USER_DISABLED` flags when a user has been disabled.
- `USER_REMOVED_FROM_GROUP` flags when a user has been removed from a group in your organization.

Add a **Webhook name** and paste the **URL** that your webhook will be sent to. **Description** is an optional field.

Choose whether to **Enable** this webhook.

Click **Create webhook**.

You'll be taken back to the **Webhooks** page. A dialog box with the message _Webhook created successfully_ will appear in the bottom right corner of your screen.

## Deleting a Webhook

From the **Organizations** list, select your organization. In the sidebar, under **Settings**, click **Webhooks**. Select the webhook you'd like to delete, then click **Delete webhooks**.

A pop-up module will appear. Click **Delete**.

You'll be taken back to the **Webhooks** page. A dialog box with the message _Webhook(s) deleted successfully_ will appear in the bottom right corner of your screen.

## Responding to Events

When your application receives webhook events, they'll take the shapes below. All `webhook` shapes are identical, while the `payload` shape changes according to the type of event.

Please also note that `organization` has a different meaning, depending on its location:
- `organization` inside the `webhook` object indicates the organization that owns the webhook.
- `organization` inside the `payload` object indicates the organization that the user is in.

##### `USER_CREATED`

```typescript
{
    "type": "USER_CREATED",
    "webhook": {
        "id": "66ec434e84b4103f670cb617",
        "organization": "parallelworks",
        "name": "demo"
    },
    "payload": {
        "username": "demo",
        "email": "demo@parallelworks.com",
        "userId": "66ec445884b4103f670d0c86",
        "organization": "parallelworks",
        "remainingSeats": 5
    }
}
```

##### `USER_DISABLED`

```typescript
{
    "type": "USER_DISABLED",
    "webhook": {
        "id": "66ec41b884b4103f670c5ee5",
        "organization": "parallelworks",
        "name": "test"
    },
    "payload": {
        "username": "demo",
        "email": "demo@parallelworks.com",
        "userId": "653c787c8e048caa7cb4e554",
        "organization": "parallelworks"
    }
}
```

##### `USER_REMOVED_FROM_GROUP`

```typescript
{
    "type": "USER_REMOVED_FROM_GROUP",
    "webhook": {
        "id": "66ec439584b4103f670cd3ae",
        "organization": "parallelworks",
        "name": "test"
    },
    "payload": {
        "username": "demo",
        "email": "demo@parallelworks.com",
        "userId": "653c787c8e048caa7cb4e554",
        "organization": "parallelworks",
        "groupName": "Demo-Group"
    }
}
```
