> For the complete documentation index, see [llms.txt](https://docs.banksocket.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.banksocket.com/webhook-yoenetimi.md).

# Webhook Yönetimi

Banksocket webhook servisi ile ilgili hesapta bir hareket oluştuğunda sistem belirlediğiniz adrese hesap hareketinini içeren bir POST ile bildirir.

Webhook servisimiz ile banka hesaplarını belirli aralıklar ile sürekli dinlemek zorunda değilsiniz. Dilerseniz sadece para girişi, dilerseniz sadece para çıkışlarını dinleyebilirsiniz.&#x20;

**Örnek Webhook POST içeriği**

```http
dc: Credit
code: EFT
amount: 100.00
balance: 18100.00
currency: TRY
description: SN:276689 TEST BANKA HAREKETİ AÇIKLAMASI ARALIK/2019
account_id: 69
account: Kadıköy İşbank TL Hesabı
bank: Türkiye İş Bankası A.Ş.
opponent_id: 1234567890
opponent_iban: TR5600000111000022200023456
hash: NmYwMGMzMDM2ZjI1Njg5MmE3ODk5NzE4ZjEzMWI4NTg2MDRmZDA3MmYwN2Q1NjVmNDMwMjZmNmUzYmViNDEwOA==
```

Gönderilen POST içeriğinin Banksocket'ten geldiğinden emin olmak için hash parametresi hesabını doğrulayabilirsiniz. Apisecret değerini hesap ayarları API bölümünden edinebilirsiniz.&#x20;

Örnek hash hesabı

```php
base64(sha256(dc + code + amount + balance + currency + description + secret))
```

## Webhook oluştur

<mark style="color:green;">`POST`</mark> `https://api.banksocket.com/v1/webhooks`

Sisteme yeni webhook görevi oluşturmak için kullanılır.&#x20;

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| Authentication | string | Kimlik denetimi başlığıdır. |

#### Request Body

| Name     | Type   | Description                                                                                                                                                                 |
| -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| title    | string | Webhook adıdır.                                                                                                                                                             |
| endpoint | string | Yeni işlem olduğunda POST gönderilecek adrestir.                                                                                                                            |
| event    | string | Görevin hangi işlemlerde tetikleneceğini belirtir. Tüm hareketler için NEW\_TRANSACTION, sadece para çıkışı  için NEW\_DEBIT, yeni para girişi için NEW\_CREDIT gönderilir. |
| account  | string | Tüm hesaplar için all gönderiniz. Sadece bir hesap dinlemek için account\_id değeri gönderiniz.                                                                             |

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

```javascript
{
    "webhook": {
        "id": 1233,
        "endpoint": "http://test",
        "title": "TR işbank api test"
    }
}
```

{% endtab %}
{% endtabs %}

## Webhook sil

<mark style="color:red;">`DELETE`</mark> `https://api.banksocket.com/v1/webhooks/:id`

#### Path Parameters

| Name | Type    | Description                               |
| ---- | ------- | ----------------------------------------- |
| id   | integer | Silinecek webhook görevinin ID değeridir. |

#### Headers

| Name           | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| Authentication | string | Kimlik denetimi başlığıdır. |

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

```javascript
{
    "status" : "success"
}
```

{% endtab %}
{% endtabs %}
