# Types

### Params Argument

**params** argument that you get in *process* function is an object that has the following structure:

| Key                  | Type                                                                                                                                                     |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| request              | [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request)                                                                                      |
| handleTag            | (payload: [CDNTagPayload](/channels/webhook/types.md#cdntagpayload), user?: { userId?: `string`; dbId?: `number` }) => `void`                            |
| getUsersByEmail      | (email: `string`) => Promise<{ userId: `string`; dbId: `number` }\[] \| `null`>                                                                          |
| getUsersByCustomData | (key: `string`, value: `string`) => Promise<{ userId: `string`; dbId: `number` }\[] \| `null`>                                                           |
| getUserByUserId      | (userId: string) => Promise<{ dbId: `string`; user: [FullUser](/channels/webhook/types.md#fulluser), customData: Record<`string`, `string`> } \| `null`> |
| saveUserCustomData   | (userId: string, key: string, value: string, dbId?: number) ⇒ Promise\<boolean>                                                                          |
| writeError           | (category: [ErrorCategory](/channels/webhook/types.md#errorcategory), error: Error)=> void                                                               |
| logger               | { log: (...args: `unknown`\[]) => `void`, error: (...args: `unknown`\[]) => `void` }                                                                     |
| secrets              | Record\<string,string>                                                                                                                                   |

### ErrorCategory

`authorization` | `payload` | `setup` | `infrastructure` | `worker` | `other` | `no-action` | `audience` | `unknown`

### CDNTagPayload

| Key       | Description                                                                               | Type                                                                                                                     | Required |
| --------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -------- |
| eventName | Event name                                                                                | `string`                                                                                                                 | Yes      |
| eventId   | Event ID that needs to be unique                                                          | `string`                                                                                                                 | Yes      |
| timestamp | Timestamp of the event                                                                    | `number`                                                                                                                 | Yes      |
| data      | Data that is sent with the event                                                          | Record<`string`, `unknown`}                                                                                              | No       |
| storage   | Storage can be used to pass consent data, see Shopify template                            | Record<`string`, `unknown`>                                                                                              | No       |
| providers | Providers that are allowed to receive this event. Example: { all: false, facebook: true } | Partial<{ all: `boolean` } & Record<`string`, Partial<({ all: `boolean` } & Record<`string`, `boolean`>) \| `boolean`>>> | No       |
| pageUrl   | URL of the page where the event happened                                                  | `string`                                                                                                                 | No       |
| pageTitle | Title of the page where the event happened                                                | `string`                                                                                                                 | No       |
| userAgent | User agent of the browser                                                                 | `string`                                                                                                                 | No       |

You can also add user information to CDNTagPayload, which is defined in [this list](/implementation/browser/user-info/standard-keys.md). The only change is that you need to prefix it with user.\
\
For example: `userEmail`, `userFirstName`

### FullUser

| Key               | Description               | Type     | Required |
| ----------------- | ------------------------- | -------- | -------- |
| email             | User's email address      | `string` | Yes      |
| phone             | User's phone number       | `string` | No       |
| firstName         | User's first name         | `string` | No       |
| lastName          | User's last name          | `string` | No       |
| gender            | User's gender             | `string` | No       |
| dateOfBirth       | User's date of birth      | `string` | No       |
| country           | User's country            | `string` | No       |
| state             | User's state              | `string` | No       |
| city              | User's city               | `string` | No       |
| zip               | User's zip code           | `string` | No       |
| ip                | User's IP address         | `string` | No       |
| consent           | User's consent string     | `string` | No       |
| consentCategories | User's consent categories | `string` | No       |
| created\_at       | User creation timestamp   | `string` | No       |
| user\_id          | User's unique ID          | `string` | Yes      |


---

# 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://docs.edgetag.io/channels/webhook/types.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.
