> For the complete documentation index, see [llms.txt](https://bonsai-docs.gitbook.io/bonsai-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bonsai-docs.gitbook.io/bonsai-docs/bonsai-notify/exports.md).

# Exports

### Client Export

#### Simple Notification

The simplest way to display a notification is:

```
exports['bonsai_notify']:Notify('success', 'Vehicle purchased successfully.')
```

The first argument is the notification type.

The second argument is the message.

#### Available Types

The default types are:

* `success`
* `error`
* `warning`
* `info`
* `money`
* `default`

For example:

```
exports['bonsai_notify']:Notify('error', 'You do not have enough money.')
```

```
exports['bonsai_notify']:Notify('warning', 'Your vehicle is damaged.')
```

```
exports['bonsai_notify']:Notify('info', 'The vehicle has been locked.')
```

```
exports['bonsai_notify']:Notify('money', 'You received $2,500.')
```

### Advanced Client Export

For more control, pass a table instead:

```
exports['bonsai_notify']:Notify({    type = 'success',    title = 'Vehicle Purchased',    description = 'Your new vehicle has been delivered.',    duration = 5000})
```

The structured export supports:

| Option         | Description                                   |
| -------------- | --------------------------------------------- |
| `type`         | Notification type                             |
| `title`        | Custom notification title                     |
| `description`  | Main notification text                        |
| `message`      | Alternative message field                     |
| `duration`     | Duration in milliseconds                      |
| `sound`        | Override the configured sound                 |
| `soundEnabled` | Enable or disable sound for this notification |
| `id`           | Optional notification identifier              |

#### Custom Duration

```
exports['bonsai_notify']:Notify({    type = 'info',    title = 'Information',    description = 'This notification will remain visible for 8 seconds.',    duration = 8000})
```

### Disable Sound

Sound can be disabled for an individual notification:

```
exports['bonsai_notify']:Notify({    type = 'info',    title = 'Information',    description = 'This notification will not play a sound.',    soundEnabled = false})
```

### Custom Sound

A notification can override the sound configured for its type.

Place the sound file inside:

```
bonsai_notify/html/sounds/
```

Then specify the filename:

```
exports['bonsai_notify']:Notify({    type = 'success',    title = 'Success',    description = 'Your action was completed.',    sound = 'custom_success.ogg'})
```

Supported formats are:

* `.ogg`
* `.mp3`
* `.wav`

`Config.SoundEnabled` remains the master sound setting. If sounds are disabled globally, a notification sound override will not force them on.

### Server Export

Bonsai Notify can also be called directly from server-side scripts.

```
exports['bonsai_notify']:Notify(source, {    type = 'money',    title = 'Payment Received',    description = 'You received $2,500.'})
```

Another example:

```
RegisterNetEvent('myresource:rewardPlayer', function()    local src = source    -- Reward logic    exports['bonsai_notify']:Notify(src, {        type = 'success',        title = 'Reward',        description = 'Your reward has been received.'    })end)
```

### Client Event

If an event is preferred instead of the client export:

```
TriggerEvent('bonsai_notify:notify', {    type = 'info',    title = 'Information',    description = 'The vehicle has been locked.'})
```

For normal integrations, the export is recommended.

### Server-to-Client Event

A server resource can also send the notification event directly to a player:

```
TriggerClientEvent('bonsai_notify:notify', source, {    type = 'money',    title = 'Payment',    description = 'You received $2,500.'})
```

### Replacing ESX.ShowNotification

#### Before

```
ESX.ShowNotification('Vehicle purchased successfully.')
```

#### After

```
exports['bonsai_notify']:Notify('success', 'Vehicle purchased successfully.')
```

### Using Bonsai Notify as a Dependency

If your resource requires Bonsai Notify, make sure it starts afterward:

```
ensure bonsai_notify
ensure your_resource
```

You can also declare the dependency in your resource's `fxmanifest.lua`:

```
dependency 'bonsai_notify'
```

Then notifications throughout the resource can consistently use:

```
exports['bonsai_notify']:Notify('success', 'Action completed.')
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://bonsai-docs.gitbook.io/bonsai-docs/bonsai-notify/exports.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
