# User Event

> Triggered when a user is created, updated, or deleted.

## Database Config

| Name          | Type     | Description                                                                                                                                                                                                                |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `key`         | `string` | \* `user` - Event Key                                                                                                                                                                                                      |
| `actions`     | `string` | <p>The action performed. Can be one of:<br>\* <code>created</code> - A new user was created.<br>\* <code>updated</code> - The status of the user is changed.<br>\* <code>deleted</code> - A user was removed from Eko.</p> |
| `title`       | `string` | Event Title                                                                                                                                                                                                                |
| `description` | `string` | Event Description                                                                                                                                                                                                          |

### Example Config

```
{
    "key" : "user",
    "actions" : [ 
        "created", 
        "updated", 
        "deleted"
    ],
    "title" : "User Event",
    "description" : "Triggered when a user is created, updated or deleted."
}
```

## Delivery headers

HTTP POST payloads that are delivered to your webhook's configured URL endpoint will contain several special headers:

| Header              | Description                                                                                                                                                                                                            |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **X-Eko-Event**     | \* `user` - Name of the event type that triggered the delivery.                                                                                                                                                        |
| **X-Eko-Signature** | The HMAC hex digest of the response body. This header will be sent if the webhook is configured with a `secret`. The HMAC hex digest is generated using the `sha256` hash function and the `secret` as the HMAC `key`. |

### Example delivery

#### headers

```
accept: application/json, text/plain, */*
content-length: 721
content-type: application/json;charset=utf-8
host: enefl77qn8s1omr.m.pipedream.net
user-agent: axios/0.19.0
x-amzn-trace-id: Root=1-5e08bfc1-b22bb8e2dcc076840831d1e0
x-eko-event: user
x-eko-signature: yfS4+byRYYVAbkEpGVq4IF0/SbreYRqPvvWSQEhWOfA=
```

#### body

```
{
  "action": "created",
  "user": {
    "_id": "5e08bfc087096951ec3ebd4c",
    "admin_panel_access": false,
    "avatar": "",
    "contacts": [],
    "coverPhoto": "",
    "deleted": false,
    "email": "support1@ekoapp.com",
    "extras": {},
    "firstname": "Support1",
    "firstname_first_character": "S",
    "invited": false,
    "is_licensed": true,
    "isBot": false,
    "isVerifiedEmail": false,
    "lastname": "Real",
    "loginCount": 0,
    "network_admin": false,
    "nid": "5dea133b76dcd3da24837353",
    "position": "",
    "redeemedPoints": 0,
    "roleIDs": [],
    "settings": {
      "workHours": {
        "enabled": false,
        "lastUpdate": "2019-12-29T14:58:09.609Z",
        "workDays": []
      }
    },
    "status": "",
    "stickerPacks": [],
    "totalPoints": 0,
    "username": "support1"
  }
}
```
