# Events

#### Available types:

* WebSockets
* Webhooks

## WebSockets

In order to **connect** to a **WebSocket**, a account or user token is needed.

{% content-ref url="api/authentication" %}
[authentication](https://biometrid.gitbook.io/biometrid-api/api/authentication)
{% endcontent-ref %}

```javascript
// WebSocket url connection
ws://biometrid.com/ws?token=...
```

{% hint style="warning" %}
In the above code block, the **domain** (biometrid.com) is the only reference that can change.
{% endhint %}

### Channels

To send and receive messages,  we must join a **channel**.

| Channel           | Token Type |
| ----------------- | ---------- |
| process:processId | Account    |
| account:accountId | User       |

## Webhooks

In order to receive some webhooks events, go to your flow and configure the required messages.

## Messages

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

| Event                                  | Data                    | Description                                            |
| -------------------------------------- | ----------------------- | ------------------------------------------------------ |
| process:created                        | {id, flowId}            | Process created                                        |
| process:status                         | {id, flowId, status}    | Process status changed                                 |
| process:updated                        | {id, flowId, stepId}    | Process has been updated                               |
| process:face\_compare\_2d2d\_processed | {status}                | Face compare 2d2d has ended                            |
| process:face\_liveness\_3d\_processed  | {status}                | Liveness 2d validation has ended                       |
| process:document\_ocr\_processed       | {status, data}          | IDCard validation has ended                            |
| process:users\_processed               | {allChildsFinished}     | Users has ended                                        |
| videoconference:start                  | {room, token, url, id } | Videoconference has been initiated by the user (agent) |
| videoconference:otp\_request           | {id}                    | Videoconference otp request                            |
| videoconference:otp\_validation        | {id, verified}          | Videoconference otp validation                         |
| videoconference:scheduled              | {id, date}              | Videoconference has been rescheduled                   |
| videoconference:end                    | {id}                    | Videoconference has ended                              |
| {% endtab %}                           |                         |                                                        |
| {% endtabs %}                          |                         |                                                        |
