# Webhooks

## How to setup a server to accept our requests

Your end must have a web server which is public and accessible by any IP address. When an event is dispatched we'll send a event object in a form of JSON data with a `Authorization` header.

## How to verify our request

It's recommended to verify every request to ensure that's really coming from us. With every request we send to your webhook we will provide an `Authorization` header. Header value will be equal to your "Your authorization" token found in the dashboard bellow the DBL webhook URL.

## Event object

```javascript
{
    "event": "event_name",
    "event_data": {...}
}
```

| Event names | Description                                          |
| ----------- | ---------------------------------------------------- |
| vote        | Dispatched when a user votes for your bot.           |
| ban         | Dispatched when there's a new ban added to the list. |
| unban       | Dispatched when a ban is deactivated or deleted.     |

#### Vote event

```javascript
{
    "event": "vote",
    "event_data": {
        "type": "upvote",
        "bot": 123456789123456789,
        "user": 123456789123456789,
        "isWeekend": false,
        "query": "?a=1&b=2"
    }
}
```

#### Ban event

```javascript
{
    "event": "ban",
    "event_data": {
        "id": 484359730374901762,
        "name": "NEGRONN",
        "discriminator": "1546",
        "moderator_id": 205680187394752512,
        "reason": "Malicious Links to collect and attract users for malicious use! Against Discord TOS",
        "proof": "https://imgur.com/a/ylXnykO",
        "is_ban_active": true,
        "can_be_appealed": true,
        "timestamp": "2018-10-30T09:38:09.233466",
        "appeal_reason": null,
        "appeal_date": null,
        "requested_by": "205680187394752512"
    }
}
```

#### UnBan event

```javascript
{
    "event": "unban",
    "event_data": {
        "id": 484359730374901762,
        "name": "NEGRONN",
        "discriminator": "1546",
        "moderator_id": 205680187394752512,
        "reason": "Malicious Links to collect and attract users for malicious use! Against Discord TOS",
        "proof": "https://imgur.com/a/ylXnykO",
        "is_ban_active": false,
        "can_be_appealed": true,
        "timestamp": "2018-10-30T09:38:09.233466",
        "appeal_reason": "they said they will be a good boye",
        "appeal_date": "2018-10-31T09:38:09.233466",
        "requested_by": "205680187394752512"
    }
}
```
