# Explorer Messenger

A utility to help library developers send messages to Coveo Explorer.

## Usage

First, create an instance of explorer messenger in your project. This instance can then be used to send a message.

```
import { createExplorerMessenger } from "@coveo/explorer-messenger";

const messenger = createExplorerMessenger();
messenger.sendMessage(...);
```

## Message

Each message's format will differ based on the kind of event it will be sent to.

### Event protocol

| Name  | Type               | Description                                                                                                                           |
| ----- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| kind  | "EVENT_PROTOCOL"   | Kind of message, always set to "EVENT_PROTOCOL"                                                                                       |
| event | EventProtocolEvent | Message's structured event                                                                                                            |
| url   | string             | Endpoint defined to communicate with the Event API                                                                                    |
| token | string             | Token to authorize the access to the Event API's validation endpoint. A view access level to the validate event privilege is required |

## Interfaces

### EventProtocolEvent

| Name | Type | Description   |
| ---- | ---- | ------------- |
| meta | Meta | `Meta` object |

You can set additional properties to define the event's payload.

#### Meta

| Name | Type   | Description       |
| ---- | ------ | ----------------- |
| type | string | The type of event |
