# Webhooks

## Danh sách webhook

<mark style="color:blue;">`GET`</mark> `[URL/api/webhooks/list`

Danh sách webhook

#### Headers

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

{% tabs %}
{% tab title="200 Danh sách Webhook" %}

```
{
    "status_code": 9999,
    "instance_id": "stg",
    "payload": [
        {
            "url": "https://demo.omicall.com/omicall/updatecall",
            "type": "call",
            "status": "actived"
        }
    ],
    "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Đăng ký Webhook

<mark style="color:green;">`POST`</mark> `[URL]/api/webhooks/register`

Ghi danh Webhook

#### Headers

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

#### Request Body

| Name    | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| webhook | object | <p>Đối tượng :<br>- <strong>type</strong> : <em>Loại Webhook</em> : call, contact<br>- <strong>url</strong> : <em>Đường dẫn Webhook</em> <br><em>- <strong>events</strong> : \["ringing",",answered","hangup"]</em></p><p><br><code>{</code> <br> <code>"webhook" : {</code> <br>   <code>"type" : "call",</code> <br>    <code>"url" : "https\://...." ,</code></p><p>    <code>"events": null</code><br>  <code>}</code> <br><code>}</code></p> |

{% tabs %}
{% tab title="200 Ghi danh Webhook thành công" %}

```
{
    "status_code": 9999,
    "instance_id": "stg",
    "payload": [
        {
            "url": "https://demo.omicall.com/omicall/updatecall",
            "type": "call",
            "status": "actived"
        }
    ],
    "key_enabled": false
}
```

{% endtab %}
{% endtabs %}

## Hủy Webhook

<mark style="color:green;">`POST`</mark> `[URL]/api/webhooks/destroy?hook_type=`

Hủy đăng ký Webhook

#### Query Parameters

| Name       | Type   | Description                                                                    |
| ---------- | ------ | ------------------------------------------------------------------------------ |
| hook\_type | string | <p>Một trong các giá trị sau<br>- <strong>call</strong> : Lịch sử cuộc gọi</p> |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.omicall.com/omicall-api/webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
