# DBL Integration

## Enable webhooks

Enabling vote hooking is very easy:

First open your KSoft.Si API dashboard ([click here](https://api.ksoft.si/dashboard)), then select your app and find this:

![DBL Webhook settings](https://165779828-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMhUVwtd5J6O3QUjxUq%2F-LQFfb6O7udm_99jo9qA%2F-LQFhEskAXrBShk1hIhB%2Fchrome_2018-11-01_20-16-44.png?alt=media\&token=d11c5aa1-d77d-46c2-a9fd-301699daf80b)

Then open your bot on [Discord Bot List](https://discordbots.org/me) and click edit. Then find this:

![](https://165779828-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMhUVwtd5J6O3QUjxUq%2F-LQFfb6O7udm_99jo9qA%2F-LQFi35x9lcKZXpzfTd4%2Fchrome_2018-11-01_20-19-50.png?alt=media\&token=eda89c49-36f9-4512-ba87-14c58f092eb4)

In the URL field paste the "Your DBL webhook:" from the dashboard and in the Authorization paste the "Your authentication". So at the end it looks like this:

![Complete settings](https://165779828-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LMhUVwtd5J6O3QUjxUq%2F-LQFfb6O7udm_99jo9qA%2F-LQFiZ2sXERzZOlVqwLZ%2Fchrome_2018-11-01_20-22-24.png?alt=media\&token=106ae48c-f9fd-43bd-bb4a-47ce6ecdaa2e)

Click save, and you are done!

## Check if user has voted

<mark style="color:blue;">`GET`</mark> `https://api.ksoft.si/webhook/dbl/check`

Check if user has voted for your bot.

#### Query Parameters

| Name | Type    | Description                            |
| ---- | ------- | -------------------------------------- |
| bot  | integer | Your bot's Discord ID.                 |
| user | integer | Discord user ID that you are checking. |

#### Headers

| Name          | Type   | Description          |
| ------------- | ------ | -------------------- |
| Authorization | string | Authentication token |

{% tabs %}
{% tab title="200 If user has voted" %}

```javascript
{
    "voted": true,
    "data": {
        "expiry": "2018-11-02T07:30:37.569592",
        "extras": {
            "reward": "004"  //Query parameters passed to a voting site
        },
        "weekend": false
    }
}
```

{% endtab %}

{% tab title="404 If user has not voted" %}

```javascript
{
    "voted": false
}
```

{% endtab %}
{% endtabs %}

## List of votes

<mark style="color:blue;">`GET`</mark> `https://api.ksoft.si/webhook/dbl/list`

Get a list of the votes. This can be done once every 10 seconds.

#### Query Parameters

| Name | Type    | Description            |
| ---- | ------- | ---------------------- |
| bot  | integer | Your bot's Discord ID. |

#### Headers

| Name          | Type   | Description          |
| ------------- | ------ | -------------------- |
| Authorization | string | Authentication token |

{% tabs %}
{% tab title="200 " %}

```javascript
[
    {
        "expiry": "2018-11-02T07:30:37.569592", 
        "extras" {
            "reward": "004"
        }, 
        "user": 175589848982355970, 
        "weekend": false
    }, 
    ...
]
```

{% endtab %}

{% tab title="429 " %}

```javascript
{
    "details": "You can access this endpoint every 10 seconds."
}
```

{% endtab %}
{% endtabs %}
